locked
Get average cpu of multiple cpu's RRS feed

  • Question

  • Hi,

    I'd like to get average cpu usage of a server which has 2 sockets, 24 cores.

    Please advise the best approach. Currently I have this, but that's only targetting 1 processor
     Get-WmiObject -computername $computername win32_processor | Measure-Object -property LoadPercentage -Average | Select-Object Average

    J.


    Jan Hoedt

    Monday, July 25, 2016 12:23 PM

Answers

  • That line gets all processors in the box and averages them.

    Here is total time over all processors:

    Get-counter -Counter '\Processor(_Total)\% Processor Time'|fl


    \_(ツ)_/

    • Marked as answer by janhoedt Tuesday, July 26, 2016 8:46 AM
    Monday, July 25, 2016 3:33 PM

All replies

  • That line gets all processors in the box and averages them.

    Here is total time over all processors:

    Get-counter -Counter '\Processor(_Total)\% Processor Time'|fl


    \_(ツ)_/

    • Marked as answer by janhoedt Tuesday, July 26, 2016 8:46 AM
    Monday, July 25, 2016 3:33 PM
  • Thanks, for me that would be (get average cpu of remote system in percentage):

    invoke-command -ScriptBlock {"{0:N0}" -f (Get-counter -Counter '\Processor(_Total)\% Processor Time' | select-object -ExpandProperty countersamples | Select-Object -ExpandProperty cookedvalue)}  -ComputerName $computername


    Jan Hoedt

    Tuesday, July 26, 2016 7:47 AM
  • Thanks, for me that would be (get average cpu of remote system in percentage):

    invoke-command -ScriptBlock {"{0:N0}" -f (Get-counter -Counter '\Processor(_Total)\% Processor Time' | select-object -ExpandProperty countersamples | Select-Object -ExpandProperty cookedvalue)}  -ComputerName $computername


    Jan Hoedt

    No.  Remember - Always read the help first in order to learn the basics.  You continue t waste time by guessing.

    Get-counter -Counter '\Processor(_Total)\% Processor Time' -ComputerName $computer | fl

    Now try to read the help to learn how this little "program" works.  A CmdLet is, at times, a program.  You need to study it to know how to use it. It is why computers have help systems and why cars have drivers manuals.


    \_(ツ)_/

    Tuesday, July 26, 2016 9:59 AM