Using WMI to retrieve performance counters
Another way to access performance information is via WMI. You can use either the WMI or the CIM cmdlets to access a large number of performance counters, as an alternative to using Get-Counter
.
When using WMI, the naming structure for counter information is different from using Get-Counter
. With WMI, counters are exposed via separate WMI classes whose names are slightly different from those you use with Get-Counter
. Effectively, with WMI, each performance counter set is a WMI class.
You find the WMI performance counters in the ROOT\CimV2
namespace; they have names that begin with Win32_Perf
. For example, the Memory
performance counter set contains 36 separate counters. The Win32_PerfFormattedData_PerfOS_Memory
WMI class contains 46 properties, including the numerous individual performance counters.
With WMI, you get all the measurements back in one call to Get-CimInstance
, whereas you would need to call Get-Counter
for each counter sample. This provides...