O'Reilly logo

Microsoft Exchange Server 2013 PowerShell Cookbook - Second Edition by Mike Pfeiffer, Jonas Andersson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Checking CPU utilization

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.

How to do it...

  1. 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:

    How to do it...
  2. In addition, we can use the Win32_Processor

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required