PowerCLI Reference

Connect-HCXServer

Synopsis

This cmdlet establishes a connection to a HCX server.

Syntax

Connect-HCXServer [-Server] <String[]> [-Credential <PSCredential>] [-Force] [-NotDefault] [-Password <SecureString>] [-Port <Int32>] [-SaveCredentials] [-User <String>] [<CommonParameters>]

Connect-HCXServer -Menu [<CommonParameters>]

Related Commands

Detailed Description

This cmdlet establishes a connection to the HCX server specified by the -Server parameter.


The connect and disconnect operations for a server are using a reference counting mechanism. Every server is identified by its connection string which contains server, user name, and port. If there is an existing connection to the server for a specific user name and port, you cannot establish a new connection. Instead, the cmdlet returns the object which represents the existing connection. The RefCount property of the object is incremented by one. Note that the returned object is the same as the one previously returned. Therefore, the RefCount of the previously returned object will be updated as well. When a server is disconnected, its RefCount property is decreased by one. If this number becomes equal to zero, the server is disconnected.


PowerCLI for HCX (Hybrid Cloud Extension) supports a list of default servers. When an operation is performed, if the target servers cannot be determined from the specified parameters, the cmdlet runs against the servers in the default server list. They are kept in a global variable called $DefaultHCXServers. It is of an array type and its initial value is an empty array. When you connect to a server, the server is added at the beginning of the array, unless the -NotDefault parameter is specified. When you disconnect from a server, the server is removed from the $DefaultHCXServers variable. When all servers are removed from the variable, its value is an empty array. You can modify the value of the $DefaultHCXServers variable manually.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
ServerString[]Specifies the IP or DNS addresses of the HCX servers you want to connect to.trueFalse
CredentialPSCredentialSpecifies a PSCredential object that contains credentials for authenticating with the server. For more information about the server authentication logic of PowerCLI, run "help about_server_authentication".falseFalse
ForceSwitchParameterSuppresses all user interface prompts during the cmdlet execution. Currently, these include 'Multiple default servers' and 'Invalid certificate action'.falseFalse
MenuSwitchParameterIndicates that you want to select a connection server from a list of recently connected servers. If Menu is set to $true, the cmdlet retrieves a list of the last visited servers and enters a nested command prompt, so that you can select a server from the list.trueFalse
NotDefaultSwitchParameterIndicates that you do not want to save the specified servers as default servers.falseFalse
PasswordSecureStringSpecifies the password you want to use for authenticating with the server. If the Credential parameter is also specified, this parameter is ignored. For more information about the server authentication logic of PowerCLI, run "help about_server_authentication".


Note: If the password contains special characters, enclose the entire string in single quotes (').
falseFalse
PortInt32Specifies the port on the server you want to use for the connection.falseFalse
SaveCredentialsSwitchParameterIndicates that you want to save the specified credentials in the local credential store.falseFalse
UserStringSpecifies the user name you want to use for authenticating with the server. If the Credential parameter is also specified, this parameter is ignored. For more information about the server authentication logic of PowerCLI, run "help about_server_authentication".


Note: If the user name contains special characters, enclose the entire string in single quotes (').
falseFalse

Return Type

CisServer

Notes

Examples

-------------------------- Example 1 --------------------------

Connect-HCXServer -Server $serverAddress -User $user -Password $pass

Connects to an HCX server by using the User and Password parameters.

-------------------------- Example 2 --------------------------

$credential = Get-Credential
Connect-HCXServer -Server $serverAddress -Credential $credential

Connects to an HCX server by using the Credential parameter.

-------------------------- Example 3 --------------------------

Connect-HCXServer -Server $serverAddress -Credential -User $user -Password $pass -SaveCredential

Connects to an HCX server and stores the credentials in the credential store.


Copyright © VMware, Inc. All rights reserved.