Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find the CPU and RAM usage using PowerShell?

Tags:

powershell

I am trying to get PowerShell to give me the RAM and CPU usage, but I can't figure out what WMI class to use. My computer has two processors, so it would be useful to have the information for both of them.

like image 956
Aaron Avatar asked Jun 09 '11 20:06

Aaron


People also ask

How do I list current CPU and memory usage in PowerShell?

In Windows PowerShell there is no exclusive cmdlet to find out the CPU and memory utilization rates. You can use the get-wmi object cmdlet along with required parameters to fetch the results.

How do I check RAM and CPU usage?

Press CTRL + Shift + Esc to open Task Manager. Click the Performance tab. This tab displays your system's RAM, CPU, GPU, and disk usage, along with network info. To view RAM usage, select the Memory box.

How do I get CPU info in PowerShell?

In the Run window, type: dxdiag (without quotation marks). In the DirectX Diagnostic Tool window, in the System tab, general information about the computer processor will be displayed.


2 Answers

You can also use the Get-Counter cmdlet (PowerShell 2.0):

Get-Counter '\Memory\Available MBytes' Get-Counter '\Processor(_Total)\% Processor Time' 

To get a list of memory counters:

Get-Counter -ListSet *memory* | Select-Object -ExpandProperty  Counter 
like image 101
Shay Levy Avatar answered Oct 19 '22 07:10

Shay Levy


Get-WmiObject Win32_Processor | Select LoadPercentage | Format-List 

This gives you CPU load.

Get-WmiObject Win32_Processor | Measure-Object -Property LoadPercentage -Average | Select Average 
like image 20
Anirudh Ramanathan Avatar answered Oct 19 '22 09:10

Anirudh Ramanathan