PowerCLI Reference

Connect-NsxtServer

Synopsis

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

Syntax

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

Connect-NsxtServer -Menu [-UseRemoteAuthentication] [<CommonParameters>]

Related Commands

Online Version
Disconnect-NsxtServer

Detailed Description

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.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
ServerString[]Specifies the DNS name or the IP address of the NSX-T servers you want to connect to.trueFalse
CredentialPSCredentialSpecifies 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".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
NotDefaultSwitchParameterSpecifies 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 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".


Note: If the password contains special characters, enclose the entire string in single quotes (').
falseFalse
PortInt32Specifies the port you want to use when connecting to the NSX-T server API URL.falseFalse
SaveCredentialsSwitchParameterIndicates 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.falseFalse
UserStringSpecifies 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".


Note: If the user name contains special characters, enclose the entire string in single quotes(').
falseFalse
UseRemoteAuthenticationSwitchParameterSpecifies that Workspace One Access (formerly VMware Identity Manager) identity provider should be used for authentication.falseFalse

Return Type

VMware.VimAutomation.Cis.Nsxt.Types.V1.NsxtServer

Notes

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.


Copyright © VMware, Inc. All rights reserved.