PowerTip: Use PowerShell to Find Performance of Processes

PowerTip: Use PowerShell to Find Performance of Processes

  • Comments 2
  • Likes

Summary: Use Windows PowerShell to quickly find the performance of process CPU utilization.

Hey, Scripting Guy! Question How can I quickly and easily find the minimum, maximum, and average CPU utilization by various processes?

Hey, Scripting Guy! Answer Open Windows PowerShell with Admin rights. Use the Get-Process cmdlet, pipe the results to the Measure-Object cmdlet, choose the CPU property, and use the –Minimum-Maximum, and –Average switches:

Get-Process | Measure-Object -Property cpu -Minimum -Maximum -Average

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Perhaps I'm missing something, but what useful information does this give me? Knowing the minimum, maximum and average amounts of cpu usage in seconds across all processes for the duration of their life (as I understand the results) seems meaningless. Without knowing how long the system has been running, you can't judge if the figures are low or high. If the max figure is for a recently started process then that might be high, but if it's been running since the system started then it might be quite reasonable.

  • As I sometimes do when trying something new I decided to play with the Measure-Object cmdlet. Not a huge thing but a thing nonetheless. If you use it with the Get-ChildItem cmdlet and try to get values for the Length property it will fail if there are no files in the directory you are looking at. My example:

    Fails:

    Get-ChildItem -Path "D:\DB-Space Project" | Measure-Object -Property Length -Minimum -Maximum -Sum

    Succeeds:

    Get-ChildItem -Path "D:\DB-Space Project" -Recurse | `

        Measure-Object -Property Length -Minimum -Maximum -Sum