Disconnect the client from the WinRM service on a remote computer.
Syntax
Disconnect-WSMan [-ComputerName string] [CommonParameters]
Key
-ComputerName string
The computer from which you want to disconnect.
A fully qualified domain name, a Net BIOS name, or an IP address.
Use the local computer name, localhost, or a dot (.) to specify the local computer.
The local computer is the default. When the remote computer is in a different domain,
use a fully qualified domain name. You can pipe a value for ComputerName.
Note: You cannot disconnect from the local host, however, if a separate connection
is made to the local computer (for example, by using the computer name), you can remove
that connection with Disconnect-WSMan.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
-OutBuffer -OutVariable.
If you saved the WS-Management session in a variable, the session object remains in the variable, but the state of the WS-Management session is "Closed".
Examples
Delete the connection to the remote server64 computer:
PS C:\> Disconnect-WSMan -computer server64
“All the disconnected people I know are trying to be something they are not, to do something they cannot do” ~ David Gayson
Related PowerShell Cmdlets:
Connect-WSMan - Connect to the WinRM service on a remote computer