How it works...

In this recipe, you use Get-CimClass to discover WMI performance classes within the Root/CimV2 namespace. You also use the Get-CimInstance cmdlet to retrieve performance information.

In step 1, you use the Get-CimClass to find the performance counter classes implemented on your system. You look at the general performance classes, then the formatted and raw classes as you discover the total number of performance classes and the number that are either raw or formatted (cooked). For the performance counters supported in WMI, there are two classes for each counter: a raw class and a cooked class. The former returns raw counter values and the latter returns cooked counter values as shown:

In step 2, you look at some of the most ...

Get Windows Server 2016 Automation with PowerShell Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.