| external help file | Microsoft.WSMan.Management.dll-Help.xml |
|---|---|
| Locale | en-US |
| Module Name | Microsoft.WSMan.Management |
| ms.date | 12/12/2022 |
| online version | https://learn.microsoft.com/powershell/module/microsoft.wsman.management/disconnect-wsman?view=powershell-7.6&WT.mc_id=ps-gethelp |
| schema | 2.0.0 |
| title | Disconnect-WSMan |
Disconnects the client from the WinRM service on a remote computer.
Disconnect-WSMan [[-ComputerName] <String>] [<CommonParameters>]
This cmdlet is only available on the Windows platform.
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.
PS C:\> Disconnect-WSMan -Computer server01
PS C:\> cd WSMan:
PS WSMan:\> dirWSManConfig: Microsoft.WSMan.Management\WSMan::WSMan
ComputerName Type
------------ ----
localhost Container
This command deletes the connection to the remote computer named server01.
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 Disconnect-WSMan to remove
connections to remote computers before you change to the WSMan provider. Those connections do not
appear in the ComputerName list.
Specifies the computer against which to run the management operation. 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.
You cannot disconnect from the local host. That is, you cannot disconnect the default connection to the local computer. However, if you create a separate connection to the local computer, for example, by using the computer name.
Type: System.String
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
You can't pipe objects to this cmdlet.
This cmdlet returns no output.