DisconnectPSSessionCommand Class

This cmdlet disconnects PS sessions (RemoteRunspaces) that are in the Opened state and returns the PS session objects in the Disconnected state. While the PS sessions are in the disconnected state, no commands can be invoked on them and any existing remote running commands will not return any data. The PS sessions can be reconnected by using the Connect-PSSession cmdlet. The cmdlet can be used in the following ways: Disconnect a PS session object: > $session = New-PSSession serverName > Disconnect-PSSession $session Disconnect a PS session by name: > Disconnect-PSSession -Name $session.Name Disconnect a PS session by Id: > Disconnect-PSSession -Id $session.Id Disconnect a PS by computer name: > Disconnect-PSSession -ComputerName localhost Disconnect a collection of PS sessions: > Get-PSSession | Disconnect-PSSession


Namespace: Microsoft.PowerShell.Commands
Assembly: System.Management.Automation (in System.Management.Automation.dll)

'Usage
Dim instance As DisconnectPSSessionCommand

[OutputTypeAttribute(System.Compiler.TypeNode[])] 
[CmdletAttribute("Disconnect", "PSSession", SupportsShouldProcess=true, DefaultParameterSetName="Session", HelpUri="http://go.microsoft.com/fwlink/?LinkID=210605", RemotingCapability=RemotingCapability.OwnedByCommand)] 
[SuppressMessageAttribute("Microsoft.PowerShell", "PS1012:CallShouldProcessOnlyIfDeclaringSupport")] 
public class DisconnectPSSessionCommand : PSRunspaceCmdlet, IDisposable
/** @attribute OutputTypeAttribute(System.Compiler.TypeNode[]) */ 
/** @attribute CmdletAttribute("Disconnect", "PSSession", SupportsShouldProcess=true, DefaultParameterSetName="Session", HelpUri="http://go.microsoft.com/fwlink/?LinkID=210605", RemotingCapability=RemotingCapability.OwnedByCommand) */ 
/** @attribute SuppressMessageAttribute("Microsoft.PowerShell", "PS1012:CallShouldProcessOnlyIfDeclaringSupport") */ 
public class DisconnectPSSessionCommand extends PSRunspaceCmdlet implements IDisposable
OutputTypeAttribute(System.Compiler.TypeNode[]) 
CmdletAttribute("Disconnect", "PSSession", SupportsShouldProcess=true, DefaultParameterSetName="Session", HelpUri="http://go.microsoft.com/fwlink/?LinkID=210605", RemotingCapability=RemotingCapability.OwnedByCommand) 
SuppressMessageAttribute("Microsoft.PowerShell", "PS1012:CallShouldProcessOnlyIfDeclaringSupport") 
public class DisconnectPSSessionCommand extends PSRunspaceCmdlet implements IDisposable

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

 

Target Platforms


Show:
© 2014 Microsoft