You can access the vSphere Automation API by connecting to a vCenter Server system through a configuration object.

You can create a configuration object and pass information about the vCenter Server system on which you want to use the vSphere Automation SDK for PowerShell. You can use this connection method if you don't want to use the PowerCLI high-level cmdlets or if you don't have the VMware.VimAutomation.Core module installed on your system.

Procedure

  1. Create a server configuration for a vCenter Server system.
    $Server = 'vCenter Server address'
    $User = 'username' 
    $Password = Read-Host -AsSecureString -Prompt "Password:"
    $serverConfig = New-vSphereServerConfiguration -Server $Server -User $User -Password $Password -SkipCertificateCheck
  2. Create a vSphere Automation API session.
    $apiSession = Invoke-CreateSession -WithHttpInfo
  3. Update the server configuration with the created API session key.
    $serverConfig | Set-vSphereServerConfigurationApiKey -SessionResponse $apiSession

What to do next

To learn more about using server configuration objects with the vSphere Automation SDK, see Managing vCenter Server Connections Through Configuration Objects.