Connect-NsxtServer

This cmdlet establishes a connection to an NSX-T server.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 and user name. If there is already an existing connection to the server for a specific user name, a new connection is not established. 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, then its RefCount property is decreased by one. If this number becomes equal to zero, then the server is disconnected.PowerCLI 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 the $defaultNsxtServers variable. The default servers list is managed in the same manner as the other default server lists for the vCenter Server and vCloud servers.If a password or user name is not specified, the local credential store is searched for relevant records. If saved credentials are found, they are used. If saved credentials are not found, you might be prompted to enter them.If the Menu parameter is specified, a list of the latest connected NSX-T servers appears.Note: If PowerShell runs in non-interactive mode, you are not prompted for credential. If the server certificate needs approval and it is not permanently accepted, it is automatically rejected and the cmdlet stops running.

Syntax

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

Parameters

Required Parameter Name Type Position Features Description
required
Server
String[] named Specifies the DNS name or the IP address of the NSX-T servers you want to connect to.
optional
Credential
PSCredential named Specifies the PSCredential object that contains credentials for authenticating with the NSX-T server. For more information about the server authentication logic of PowerCLI, run "help about_server_authentication".
optional
NotDefault
SwitchParameter named Specifies that you do not want to save the specified servers as default servers.
optional
Password
SecureString named Specifies the password you want to use for authenticating with the NSX-T 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".
optional
Port
Int32 named Specifies the port you want to use when connecting to the NSX-T server API URL.
optional
SaveCredentials
SwitchParameter named Indicates that you want to save the specified credentials in the local credential store. When you save credentials for a specific server, you do not need to specify them each time you reconnect.
optional
UseRemoteAuthentication
SwitchParameter named Specifies that Workspace One Access (formerly VMware Identity Manager) identity provider should be used for authentication.
optional
User
String named Specifies the user name you want to use for authenticating with the NSX-T 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".

-Menu
[-UseRemoteAuthentication]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
Menu
SwitchParameter named Indicates 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.
optional
UseRemoteAuthentication
SwitchParameter named Specifies that Workspace One Access (formerly VMware Identity Manager) identity provider should be used for authentication.

Output

Examples


Example 1

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

Connects to an NSX-T server by using the User and Password parameters.

Example 2

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

Connects to an NSX-T server by using the Credential parameter.

Example 3

Connect-NsxtServer -Server $serverAddress -Credential -User $user -Password $pass -SaveCredentials

Connects to an NSX-T server and stores the credentials in the credential store.

Example 4

Connect-NsxtServer -Server $serverAddress -User $user

Connects to an NSX-T server when a record for the specified server and user is available in the credential store.

Related Commands

Feedback

Was this page helpful?