Home » How to Get CPU Usage by Process in PowerShell

How to Get CPU Usage by Process in PowerShell

To view the CPU usage by a process in PowerShell, you can use the Get-Process cmdlet with the Sort-Object.

The following example shows how you can do it.

Get-Process chrome | Sort-Object -Property CPU -Descending | Select-Object -First 10

Output:

PowerShell get cpu usage by process
PowerShell get cpu usage by process

In this script, the Get-Process cmdlet retrieves the “chrome” processes from the system and pipes them to the Sort-Object cmdlet.

The Sort-Object command sorts the processes by their CPU property and pipes them to the Select-Object cmdlet to select the first 10 processes with high CPU usage.

After running the script, it will display the top 10 processes with high CPU usage along with the Names, IDs, and CPU for the Chrome process.

Conclusion

I hope the above article on how to get CPU usage by process in PowerShell is helpful to you.

You can find more topics about Active Directory tools and PowerShell basics on the ActiveDirectoryTools home page.