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 20.11 and later · SCOM 2019, 2022, 2025 · vCenter 7.0, 8.0, 9.0
Last updated: October 2026 · Reading time: 3 minutes

Goal

Add, update or remove vCenter and ESXi connections, and assign host licenses, from PowerShell instead of the VMware IMP Configuration Dashboard. This saves time when you manage many connections. The examples below handle one connection, but you can adapt them for several.

Prerequisites

  • VMware Management Pack 20.11 or later. The PowerShell module is part of the software bundle.
  • A valid VMware Management Pack license, imported in the OpsLogix Licensing Dashboard. See Import the VMware Management Pack license key.
  • A SCOM management server where the OpsLogix VMware Collector is installed. Copy the module to this server and run the script there.

Steps

Step 1: Load the module

Change the path to where you copied the installation package.

Import-Module "C:\install\Opslogix VMware\OpsLogix VMWare PowerShellModule\OpsLogix.VMware.PowerShellModule.dll"

# check that the module is loaded
get-module 'OpsLogix.VMware.PowerShellModule'

Step 2: Add or update a connection

Fill in your connection details. If the connection already exists, it's updated.

$LicenseKey = "paste encrypted license key here"
$vCenterFQDN = "vcenter01.contoso.com"
$ServiceAccUsername = "administrator@vsphere.local"
$ServiceAccPlainPassword = "*******"
$ResourcepoolName = "OpsLogix Resource Pool for VMware Management Pack"

Add-SCOMVMwareConnection -Verbose -OpsMgrSDK "localhost" -vCenterFQDN $vCenterFQDN -ServiceAccUsername $ServiceAccUsername -ServiceAccPlainPassword $ServiceAccPlainPassword -ResourcepoolName $ResourcepoolName -LicenseKey $LicenseKey

# give SCOM time to process the connection
sleep 120

Step 3: Assign host licenses

Without filters, every host gets a license as long as you have licenses left. To filter connections and hosts, use regular expressions in ConnectionRegEx and HostRegEx.

Set-SCOMVMwareHostLicences

# or, with filters
Set-SCOMVMwareHostLicences -ConnectionRegEx "()" -HostRegEx "()"

Optional: Unassign licenses or remove a connection

# unassign licenses from specific hosts
Set-SCOMVMwareHostLicences -HostRegEx "(Host1|Host2)" -Assign $false

# remove a connection
Remove-SCOMVMwareConnection -Verbose -vCenterFQDN "vcenter01.contoso.com"

Verify it worked

In SCOM, go to Administration > OpsLogix MP Configuration > VMware IMP Configuration Dashboard. Check that the connection is listed on the Add/Remove Connections tab and that the hosts are selected on the Assign tab.

See also