Disconnect-HCXServer Command | Vmware PowerCLI Reference

Disconnect-HCXServer

This cmdlet closes the connection to one or more HCX servers.When no servers and no user name are specified, and if there is only one connected server in $DefaultHCXServers variable, this server is disconnected. If there is no connected server, the cmdlet throws a terminating error.This functionality uses the reference counting mechanism. For more information about the mechanism, see the Connect-HCXServer cmdlet.When there are no active connections to the server, it gets disconnected and is removed from the $DefaultHCXServers variable. For more information about this variable, see the Connect-HCXServer cmdlet.If the -Force parameter is specified, the server disconnects even if there is more than one connection to it.

Syntax

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

Parameters

Required Parameter Name Type Position Features Description
optional Force SwitchParameter named
Indicates that you want to close all active connections to the specified server and disconnect from it.
optional Server CisServer[] named
  • pipeline
Specifies the HCX servers you want to disconnect from.

Output

Examples

Example 1

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

Disconnects the specified HCX server without asking for confirmation.

Example 2

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

Disconnects the specified HCX server without asking for confirmation.

Related Commands

HCXServer

This cmdlet establishes a connection to a HCX server.

This cmdlet closes the connection to one or more HCX servers.