Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 4.0 » Disconnect-PSSession

Disconnect-PSSession - Powershell 4.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Disconnect-PSSession

Short description
Disconnects from a session.

Syntax


Description
The Disconnect-PSSession cmdlet disconnects a Windows PowerShell session ("PSSession"), such as one started by using 
the New-PSSession cmdlet, from the current session. As a result, the PSSession is in a disconnected state. You can 
connect to the disconnected PSSession from the current session or from another session on the local computer or a 
different computer.


The Disconnect-PSSession cmdlet disconnects only open PSSessions that are connected to the current session. 
Disconnect-PSSession cannot disconnect broken or closed PSSessions, or interactive PSSessions started by using the 
Enter-PSSession cmdlet,  and it cannot disconnect PSSessions that are connected to other sessions.


To reconnect to a disconnected PSSession, use the Connect-PSSession or Receive-PSSession cmdlets.


When a PSSession is disconnected, the commands in the PSSession continue to run until they complete, unless the 
PSSession times out or the commands in the PSSession are blocked by a full output buffer. To change the idle timeout, 
use the IdleTimeoutSec parameter. To change the output buffering mode, use the OutputBufferingMode parameter You can 
also use the InDisconnectedSession parameter of the Invoke-Command cmdlet to run a command in a disconnected session.


For more information about the Disconnected Sessions feature, see about_Remote_Disconnected_Sessions.


This cmdlet is introduced in Windows PowerShell 3.0.