Syntax
Connect-VIServer [-Server] <String[]> [-Port <Int32>] [-Protocol <String>] [-Credential <PSCredential>] [-User <String>] [-Password <String>] [-Session <String>] [-NotDefault] [-SaveCredentials] [-AllLinked] [-Force] [<CommonParameters>]Related Commands
Online versionDetailed Description
This cmdlet establishes a connection to a vCenter Server system. The cmdlet starts a new session or re-establishes a previous session with a vCenter Server system using the specified parameters.Parameters
Return Type
VIServerNotes
When you connect to a server via Connect-ViServer you allocate resources on this server, and these resources remain opened until Disconnect-ViServer -Force is called on this connection. Closing the PowerCLI process does not close the server resources.Examples
-------------- Example 1 --------------
Connect-VIServer -Server 10.23.112.235 -Protocol https -User admin -Password pass
Connects to a vSphere server using the User and Password parameters.
-------------- Example 2 --------------
Connect-VIServer Server -Credential $myCredentialsObject -Port 1234
Connects to a vSphere server by using a credential object.
-------------- Example 3 --------------
Connect-VIServer "Server" -SessionId $sessionId
Connect by using a server session ID.
Once you connect to a server, you can save the session ID - $serverObject.SessionId, so that you can restore the existing server connection instead of reconnecting.
-------------- Example 4 --------------
Connect-VIServer Server
Connect by using integrated authentication. In this case, the credentials you are logged on to your machine must be the same as those for the server.
-------------- Example 5 --------------
Connect-VIServer "Server" -User user -Password pass -SaveCredentials
Connect to a server and save the credentials in the credential store. After the credentials are stored, you can connect to the server without specifying them. To get a previously saved credential store item, use the Get-VICredentialStoreItem cmdlet.
-------------- Example 6 --------------
Connect-VIServer -Menu
Connect to a server by choosing the server address from a list of previously connected servers.
-------------- Example 7 --------------
Connect-VIServer "Server" -AllLinked
Connect to a vSphere server which is a part of a federation vCenter Server. This will Connect you to all vSphere servers in the federation as well.