PowerCLI 4.1.1 introduces the new Get-EsxTop cmdlet. This cmdlet provides functionality similar to the “esxtop” utility. The cmdlet allows you to access a wide variety of stats for your virtual environment – thus allowing you to create even more versatile reports using PowerCLI.

There are 3 types of data returned by the cmdlet – counter information, topology information, and statistical data. The counter information shows you the available counters on your ESX as well as their properties (metadata information). To list all available counters you can simply do:

Get-EsxTop –Counter
#  View the fields available for VCPU counter:
(Get-EsxTop –Counter –CounterName VCPU).Fields

The topology information contains either inventory data that does not change (e.g. physical CPU information) or a counter instance structure describing the relationship between different counters. To list all available topologies, run:

Get-EsxTop –TopologyInfo
# View the entries of a specific topology:
(Get-EsxTop –TopologyInfo –Topology SchedGroup).Entries | Format-Table

Finally the statistical data gives you the actual values for the available counters:

# Retrieve the counter values for “VCPU” and “SchedGroup” counters:
Get-EsxTop –CounterName VCPU | Format-Table * -AutoSize
Get-EsxTop –CounterName SchedGroup | Format-Table * -AutoSize

You can use these three sources to navigate the esxtop information and build your reports.

Get-EsxTop works on ESX 4.0 or newer. The cmdlet is dynamic in its nature, meaning that the returned values may differ between ESX versions and the actual data returned is appended as PowerShell dynamic properties to the output objects. Please note that the cmdlet is currently experimental and its output may change in future PowerCLI versions.