Get CPU Usage Using PowerShell

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

}

This entry was posted in KB. Bookmark the permalink.