-
Book Overview & Buying
-
Table Of Contents
Microsoft Exchange Server 2013 PowerShell Cookbook: Second Edition - Second Edition
By :
One of the best ways to monitor CPU utilization with PowerShell is by querying performance counters. We can also get this information using WMI. In this recipe, you'll learn a few techniques that can be used to monitor CPU utilization using the
Get-Counter and
Get-WmiObject cmdlets.
To get an idea of the current CPU utilization for a server, we can gather data for the Processor(_Total)\% ProcessorTime performance counter:
Get-Counter "\Processor(_Total)\% Processor Time" -Continuous
This would continuously output the total utilization across each CPU, as shown:

In addition, we can use the Win32_Processor class and select the LoadPercentage property to determine the utilization for each CPU:
Get-WmiObject Win32_Processor | select LoadPercentage
Both Get-Counter and Get-WmiObject support the -ComputerName parameter and can be run against remote machines.
The Processor(_Total)\% ProcessorTime performance counter measures the total utilization...
Change the font size
Change margin width
Change background colour