Getting Started with VMware vSphere and vSAN cmdlets

Provides cmdlets for automated administration of the vSphere environment.

Step 1: Connect to Environment 


To setup a connection you should use the Connect-VIServer command. Run the code sample below to connect.
Connect-VIServer -Server 10.23.112.235 -Protocol https -User admin -Password pass
You can also connect to remote environment by running one of the alternative options to connect below:

Option 1:
Connect-VIServer Server -Credential $myCredentialsObject -Port 1234
Option 2:
Connect-VIServer "Server" -SessionId $sessionId
Option 3:
Connect-VIServer Server
Option 4:
Connect-VIServer "Server" -User user -Password pass -SaveCredentials
Option 5:
Connect-VIServer -Menu
Option 6:
Connect-VIServer "Server" -AllLinked
Option 7:
$oauthCtx = New-VcsOAuthSecurityContext -ApiToken "a3f35067-80b5-44f0-a0bc-e19f2bc17fb7"
$samlCtx = New-VISamlSecurityContext -VCenterServer "Server" -OAuthSecurityContext $oauthCtx
Connect-VIServer -Server "Server" -SamlSecurityContext $samlCtx

Step 2: Try a GET Command 


For example when successfully connected you can run the Get-CustomCertificates command.
C:\PS> Get-CustomCertificates
Feedback

Was this page helpful?