Get Machine CPU, Memory and Storage With PowerShell

In this blog post, I will show you how to tap into your Windows machine performance counter using PowerShell and get real-time information about your machine’s performance.

PowerShell 7, has improved the way we can tap into our machine and check the performance without using GUI tools. The most convenient thing is that we can get real-time information also knows and continues data without needing to re-run the cmdlet.

Get-Counter

The get-counter cmdlet allows us to do check CPU, Memory, Storage and almost any applications that run on our machine and as of writing this post, there are 217 counters to tap into in Window 10.

To view all the available counter PowerShell has to offer we can run the following cmdlet using the paging switch I told you about.

Get-Counter -ListSet * | Out-Host -Paging

To get a list only with the names run the cmdelt below.

Get-Counter -ListSet * | select countersetname | Out-Host -Paging

For example, to get real-time CPU usage on my Windows 10 or Windows Server machine I will use the following cmdlet.

Get-Counter -Counter "\Processor(_Total)\% Processor Time" -Continuous

Once you know your counter name use the path and run. To find the Memory counter and all the options it offers to run the following cmdlet.

Get-Counter -ListSet memory

Below a cmdlet that will get amount of available memory in bytes,

Get-Counter -Counter "\memory\available bytes" -Continuous

Processing…
Success! You're on the list.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.