Get CPU Usage Using PowerShell

by admin on October 4, 2009

powershell

 For some time I have been looking for a simple powershell script that will give me the  computer’s CPU usage with no luck.

After failing to find one and had some spare time I have done a small research and came up with a little WMI line that gives the CPU usage as follow:

Get-WmiObject win32_processor | select LoadPercentage  |fl

The line uses the WMI class and display the CPU usage.

I have also created a script that refresh every 10 seconds and shows the CPU usage.

while ($true)

{

Start-Sleep -s 15

cls

‘CPU Load is’

Get-WmiObject win32_processor | select LoadPercentage  |fl

}

  • Share/Bookmark

Related posts:

  1. Check and Auto Refresh Exchange Server Mail Queue Using Exchange Shell
  2. Lock Desktops using group policy
  3. Scripting and automating backup jobs using NTbackup
  4. Question:How To Set Execution Policy In PowerShell 2.0
  5. Microsoft PowerShell Command Guide – Part 1

Leave a Comment

Previous post:

Next post: