Home > PowerShell > Use PowerShell to monitor CPU ulitization

Use PowerShell to monitor CPU ulitization

You can use this simple command to query CPU utilization of local/remote machine with PowerShell. This is really useful for troubleshooting issues. Enjoy…

Get-Counter -ComputerName “RemotePCName” ‘Processor(*)% Processor Time’ -Continuous -SampleInterval 5

This queries remote computer CPU usage for every 5 seconds continously.

If you want to query the local computer CPU utilization, simply use below command.

Get-Counter ‘Processor(*)% Processor Time’ -Continuos -SampleInterval 5

Hope you liked it.

No related content found.

  1. AKP
    May 29, 2011 at 6:44 pm | #1

    Hi Techibee,

    Thank you for your script. But
    I have a problem while implementing this script, let me know how to start:

    I want to get an alert if CPU usage is over 85% and stay for more then 2 min continuous then alert via email. Pl send me some power shell script for this issue.

    Thanks
    AKP

  2. Rob Seymour
    August 2, 2011 at 7:10 pm | #3

    Hello,

    This is a lovely little script, but how can I return the statistics for the individual processes that are consuming the CPU resources? It is great to know that the overall CPU usage is 95% but to know that SQL server is using 85% of that would be really helpful for troubleshooting.

    I know this is an old thread but can you help out here?

    Thanks

    Rob

  3. gerby
    March 7, 2012 at 11:51 pm | #4

    no worky…

    • March 12, 2012 at 10:30 pm | #5

      @gerby, I see that you commented on two posts in this blog saying the solution is “not working”. That is very generic statement and I request you to post the exact error message you are seeing. That helps me to comment better.

  1. No trackbacks yet.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>