Skip to content
English
  • There are no suggestions because the search field is empty.

Manage VMware connections with PowerShell

Add, update and remove vCenter and ESXi connections and assign host licenses with the OpsLogix PowerShell module.

Applies to: OpsLogix VMware Management Pack 26.6 and later · SCOM 2019, 2022, 2025 · vCenter 7.0, 8.0, 9.0
Last updated: November 2026 · Reading time: 4 minutes

Goal

Manage VMware connections, collector deployment and host licenses from PowerShell, for example to automate the setup of many connections. The OpsLogix VMware PowerShell module offers four cmdlets for the same tasks as VMware MP Configuration.

Before you start, read Known issues below. For some tasks, VMware MP Configuration is currently the more reliable choice.

Prerequisites

  • The VMware Management Pack installation package. The module is in the folder PowerShell Module of the package.
  • Windows PowerShell 5.1 on a SCOM management server, or on a computer with the Operations console installed. The module uses the SCOM SDK from there.
  • A SCOM administrator account.
  • A license key imported. See Import the VMware MP license key.

Step 1: Load the module

  1. Copy the PowerShell Module folder to the server, for example to C:\OpsLogix\PowerShell Module. If you downloaded the package from the internet, unblock the files first. Otherwise Windows doesn't load the module, and Import-Module fails with Could not load file or assembly ... (Exception from HRESULT: 0x80131515).
  2. Import the module manifest (.psd1). In versions before 26.11.4549.0, the manifest names the wrong files; import the DLL instead, as shown in the comment.
Get-ChildItem "C:\OpsLogix\PowerShell Module" -Recurse | Unblock-File
Import-Module "C:\OpsLogix\PowerShell Module\OpsLogix.VMWare.PowerShellModule.psd1"
# Before 26.11.4549.0: Import-Module "C:\OpsLogix\PowerShell Module\OpsLogix.VMware.PowerShellModule.dll"

# Check that the cmdlets are available
Get-Command -Module OpsLogix.VMware.PowerShellModule

Cmdlets

Cmdlet Parameters What it does
Install-VMwareCollector -ResourcepoolName (required)
-OpsMgrSDK (default localhost)
Installs or updates the OpsLogix VMware Collector on every server in the resource pool, like Check Connection does.
Add-SCOMVMwareConnection -vCenterFQDN, -ServiceAccUsername, -ServiceAccPlainPassword, -ResourcepoolName (required)
-LicenseKey (required before 26.11.4549.0; from 26.11.4549.0 optional and not used, the key comes from the imported license)
-OpsMgrSDK (default localhost)
Deploys the collector to the resource pool and adds the connection, or updates it if it already exists. It doesn't test the connection first, and it can't set scale out. -LicenseKey is required but not used; any value works. If the connection already exists, it updates its account and password and keeps its scale-out members.
Remove-SCOMVMwareConnection -VCenterFQDN (required)
-OpsMgrSDK (default localhost)
Removes the connection. Turn off scale out first; scale-out groups aren't removed.
Set-SCOMVMwareHostLicences -ConnectionRegEx (default ())
-HostRegEx (default ())
-Assign (default $true; $false removes licenses)
-SkipOverlicensed (default $true)
-OpsMgrSDK (default localhost)
Assigns licenses to, or removes them from, the hosts of one connection. See Known issues.

Notes:

  • -ResourcepoolName is the Name of the resource pool. For OpsLogix Resource Pool for VMware Management Pack, the name and display name are the same. For other pools, run Get-SCOMResourcePool | Format-Table Name, DisplayName to check.
  • -ConnectionRegEx is matched against the connection URL, for example https://vcenter01.contoso.com/sdk, and must match exactly one connection. With the default () and more than one connection, the cmdlet stops with Multiple connections found matching the provided regex.
  • The cmdlets write their progress with WriteDebug. Add -Debug, not -Verbose, to see it.

Step 2: Examples

# Add a connection, or change the account of an existing one (26.11.4549.0 and later)
$credential = Get-Credential -Message "VMware monitoring account"
Add-SCOMVMwareConnection -vCenterFQDN "vcenter01.contoso.com" -ServiceAccUsername $credential.UserName -ServiceAccPlainPassword $credential.GetNetworkCredential().Password -ResourcepoolName "OpsLogix Resource Pool for VMware Management Pack" -Debug

# Install or update the collector on all members of the resource pool
Install-VMwareCollector -ResourcepoolName "OpsLogix Resource Pool for VMware Management Pack" -Debug

# Remove a connection
Remove-SCOMVMwareConnection -VCenterFQDN "vcenter01.contoso.com" -Debug

# Remove the licenses of two hosts of one connection
Set-SCOMVMwareHostLicences -ConnectionRegEx "vcenter01\.contoso\.com" -HostRegEx "^(esx01|esx02)\." -Assign $false -Debug

Known issues

  • In versions before 26.11.4549.0, Add-SCOMVMwareConnection stops with Sequence contains no matching element and doesn't add or update the connection. Upgrade, or add connections in VMware MP Configuration. See Add a vCenter or ESXi connection.
  • Set-SCOMVMwareHostLicences with -Assign $true licenses all hosts of the connection, not only the hosts that match -HostRegEx, and checks the license count by number of hosts instead of CPU sockets. Assign licenses on the Assign tab instead. See Assign VMware MP licenses to ESXi hosts.
  • Set-SCOMVMwareHostLicences -Assign $false stops with an error if no license has been assigned on the connection yet.

Verify it worked

Go to Administration > OpsLogix MP Configuration > VMware MP Configuration. Check the connection list on the Add/Remove Connections tab, and click Refresh on the Assign tab to check the license assignment.

See also