Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Disconnect-WSMan

Disconnect-WSMan

microsoft.wsman.management.dll

Synopsis

Disconnects the client from the WinRM service on a remote computer.

Syntax

Disconnect-WSMan [-ComputerName] [<CommonParameters>]

Detailed Description

The Disconnect-WSMan cmdlet disconnects the client from the WinRM service on a remote computer. 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". You can use this cmdlet within the context of the WSMan provider to disconnect the client from the WinRM service on a remote computer. However, you can also use this cmdlet to disconnect from the WinRM service on remote computers before you change to the WSMan provider.

For more information about how to connect to the WinRM service on a remote computer, see Connect-WSMan.

Parameters

-ComputerName <String>

Specifies the computer from which you want to disconnect. The value can be a fully qualified domain name, a NetBIOS name, or an IP address. Use the local computer name, use localhost, or use a dot (.) to specify the local computer. The local computer is the default. When the remote computer is in a different domain from the user, you must use a fully qualified domain name must be used. You can pipe a value for this parameter to the cmdlet.

Note: You cannot disconnect from the local host (the default connection to the local computer). However, if a separate connection is made to the local computer (for example, by using the computer name), you can remove that connection by using the Disconnect-WSMan cmdlet .

Aliases

None

Required?

false

Position

1

Default value

localhost

Accept pipeline input?

false

Accept wildcard characters?

false

Input Type

None

Return Type

None

Notes

None

Examples

-------------------------- EXAMPLE 1 --------------------------

This command deletes the connection to the remote server01 computer.

This cmdlet is generally used within the context of the WSMan provider to disconnect from a remote computer, in this case the server01 computer. However, you can also use the Disconnect-WSMan cmdlet to remove connections to remote computers before you change to the WSMan provider. Those connections will not appear in the ComputerName list.

PS C:\>Disconnect-WSMan -computer server01
PS C:\>cd WSMan:
PS WSMan:\>
PS WSMan:\> dir
WSManConfig: Microsoft.WSMan.Management\WSMan::WSMan
ComputerName                                  Type
------------                                  ----
localhost                                     Container

Online Version
Connect-WSMan
Disable-WSManCredSSP
Enable-WSManCredSSP
Get-WSManCredSSP
Get-WSManInstance
Invoke-WSManAction
New-WSManInstance
New-WSManSessionOption
Remove-WSManInstance
Set-WSManInstance
Set-WSManQuickConfig
Test-WSMan