Count the CPU sockets in your VMware environment
Count the CPU sockets of your ESXi hosts to see how many VMware Management Pack licenses you need.
Applies to: OpsLogix VMware Management Pack (all versions) · vCenter 7.0, 8.0, 9.0
Last updated: October 2026 · Reading time: 2 minutes
Goal
Count the physical CPU sockets of your ESXi hosts. The VMware Management Pack is licensed per socket, so this tells you how many licenses you need. There are three ways to do this.
Prerequisites
- A vCenter account with top-level read access.
- For option 3: VMware PowerCLI. See Install VMware PowerCLI on Windows Server.
Option 1: Use the Assign tab
If you already added your vCenter connection in SCOM, go to Administration > OpsLogix MP Configuration > VMware MP Configuration, open the Assign tab and click Refresh. Total Socket Count shows the number of sockets of all hosts, and each host shows its own socket count.
Option 2: Use the HostInventory tool
- Download the OpsLogix.VMware.HostInventory command-line tool (zip file) and extract it.
- Run the tool. It connects to your vCenter server and shows the number of processor sockets per ESXi host, and the total.
Option 3: Run a PowerShell script
- Copy the script below and save it as GetCoreAndSocketCount.ps1.
- Change $VCenter to the name of your vCenter server.
- Run the script with a top-level account.
## ===========================================================
## GetCoreAndSocketCount.ps1
## ===========================================================
## Vmware license inventory script
## OpsLogix
## Michel Kamp
## -----------------------------------------------------------
## This Script counts the number of sockets over all ESX hosts
## that are member of the VCenter connection
## -----------------------------------------------------------
## Requirements:
## - vSphere PowerCLI must be installed.
## Install it with: Install-Module VMware.PowerCLI
## - run using logged on as top level account
## Configuration:
## - Change $VCenter to the VCenter server name.
## ===========================================================
$VCenter = "localhost"
## Connecto to Vcenter
Connect-viserver -Server $VCenter
## get the cpu inventory
$result = @()
$EsxHosts = Get-view -ViewType HostSystem
foreach ($EsxHost in $EsxHosts) {
$obj = new-object psobject
$obj | Add-Member -MemberType NoteProperty -Name name -Value $EsxHost.Name
$obj | Add-Member -MemberType NoteProperty -Name CPUSocket -Value $EsxHost.hardware.CpuInfo.NumCpuPackages
$obj | Add-Member -MemberType NoteProperty -Name CoresPerSocket -Value ($EsxHost.hardware.CpuInfo.NumCpuCores / $EsxHost.hardware.CpuInfo.NumCpuPackages)
$obj | Add-Member -MemberType NoteProperty -Name TotalCores -Value $EsxHost.hardware.CpuInfo.NumCpuCores
$result += $obj
}
## provide full details
Write-Output "Overview of all sockets and cores per ESX host"
$result | ft *
## calculate the total sockets
Write-Output "Total Socket count from all ESX hosts"
($result | Measure-Object -Property CPUSocket -Sum).Sum
## calculate the total cores
Write-Output "Total Core Count over all Sockets from all ESX hosts"
($result | Measure-Object -Property TotalCores -Sum).sum
## ===========================================================
## End script
## ===========================================================
Verify it worked
The output shows the sockets and cores per ESXi host, followed by the total socket count. The total socket count is the number of licenses you need to monitor all hosts.
See also
- How is the VMware Management Pack licensed?
- Assign VMware Management Pack licenses to ESXi hosts
- Install VMware PowerCLI on Windows Server