Book Image

Microsoft Exchange 2010 PowerShell Cookbook

Book Image

Microsoft Exchange 2010 PowerShell Cookbook

Overview of this book

Table of Contents (22 chapters)
Microsoft Exchange 2010 PowerShell Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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-Counterand 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)\% Processor Time performance counter:

    Get-Counter "\Processor(_Total)\% Processor Time" -Continuous

    This would continuously output the total utilization across each CPU, as shown:

  2. 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.

How it works...

The Processor(_Total)\% Processor Time performance counter measures the total utilization...