The vSphere Automation SDK for PowerShell features special configuration object cmdlets to manage vCenter Server connections. А configuration object is a client-side PowerShell object that holds information about a server that the Invoke- cmdlets can interact with.

Table 1. Configuration Object Cmdlets

Cmdlet

Description

New-vSphereServerConfiguration

Creates a vCenter Server configuration object.

Get-vSphereServerConfiguration

Retrieves the existing vCenter Server configuration objects.

Set-vSphereServerConfiguration

Updates a vCenter Server configuration object.

Set-vSphereServerConfigurationApiKey

Updates a vCenter Server configuration object with an API key for authorization.

Remove-vSphereServerConfiguration

Removes a vCenter Server configuration object.

Working with Configuration Objects

You can create multiple vCenter Server configuration objects and manage all of them simultaneously with the Invoke- cmdlets. For example, Invoke-DeleteSession deletes all existing vSphere Automation API sessions.

If you want to apply the Invoke- cmdlets to a specific configuration object, you must specify it in the command. For example,

Invoke-ListFolder -Server $serverConfig

Example Use Cases with vCenter Server Configuration Objects

  • You can create a session and authenticate to a vSphere Automation API server - see Connect Through a Configuration Object.

  • You can retrieve the active server configurations.

    Get-vSphereServerConfiguration
  • You can remove a specific server configuration.

    $serverConfig | Remove-vSphereServerConfiguration