Disconnect-NsxtServer Command | Vmware PowerCLI Reference

Disconnect-NsxtServer

This cmdlet closes the connection to one or more NSX-T servers.When no servers are specified, and if there is only one connected server in the $defaultNsxtServers variable, this server is disconnected. If there is no connected server, the cmdlet throws a non-terminating error.This functionality is using the reference counting mechanism. For more information about the mechanism, see Connect-NsxtServer.When there are no more active connections to the server, it gets disconnected and then it is removed from the $defaultNsxtServers variable (if it is present). For more information about this variable, see Connect-NsxtServer.If the Force parameter is specified, the server is disconnected even if there is more than one connection to it. The RefCount property of the object is incremented by one.

Syntax

Disconnect-NsxtServer
[-Force ]
[-Server < CisServer[] > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
optional Force SwitchParameter named
Specifies that you want to remove all existing connections to the specified NSX-T servers.
optional Server CisServer[] named
  • pipeline
  • wildcards
Specifies the NSX-T servers you want to disconnect from.

Output

Examples

Example 1

$server = Connect-NsxtServer -Server 'server_name' -User 'user@domain' -Password 'user_password'
Disconnect-NsxtServer $server -Confirm:$false

Disconnects the specified NSX-T server without asking for confirmation.

Example 2

Connect-NsxtServer -Server 'server_name' -User 'user@domain' -Password 'user_password'
Connect-NsxtServer -Server 'server2_name' -User 'user@domain' -Password 'user_password'
Disconnect-NsxtServer * -Confirm:$false

Disconnects all connected NSX-T servers without asking for confirmation.

Related Commands

NsxtServer

This cmdlet establishes a connection to an NSX-T server.

This cmdlet closes the connection to one or more NSX-T servers.