How to Check CPU Usage Using PowerShell [Script Added]

Written By Farhan Max

Successively updating technology is bringing new possibilities and new user experiences to everyone. With such opportunities, countless errors and exceptions are rising in our systems unexpectedly.

I’ve seen numerous types of troubles, errors, exceptions, and situations while dealing with computers of mine and others.

Some use cases require ridiculous ways to fix or operate, where PowerShell is the only tool to rely upon. Even a simple task like monitoring CPU usage is done using PowerShell.check-cpu-usage-using-powershell

In this article, I’ll explain how you can check your CPU usage with the help of PowerShell.

How to Check CPU Utilization Using PowerShell?

Any simple Windows user will be shocked to hear that anyone uses PowerShell to check the CPU usage on the system. It is indeed too complicated a process to check CPU utilization, but there are certain circumstances when a user would require such a crazy process.

Here is how you can access PowerShell and watch CPU usage:

Method 1 – Only CPU Usage (Ping)

In this method, you can easily check the CPU load percentage of the instant time. It’s a quite simple task to perform as it only requires copy & paste skills.

Here are the steps you should follow to observe CPU usage at the time you hit enter:

  • Press the combo key Windows + X — you’ll see a list.
  • Click on PowerShell (Admin).
  • Paste this script in PowerShell.
    Get-WmiObject Win32_Processor | Select LoadPercentage | Format-List
  • You will see the Load Percentage on CPU at that particular time, as shown in the picture below.load-percentage-on-cpu
  • Paste again if you want to see the change in load.

Note: Even though you can only see the load percentage of the CPU one time after pasting the code one time. You can paste the code several times to see the CPU load as per your need, or you can check the other method.

You can also check the CPU usage on Mac. For detailed instructions, check our separate article.

Method 2 – CPU and RAM Usage (Continuous)

In this method, you can inspect the exact CPU usage and RAM usage at a percentage continuously, with the date and exact time. But there is nothing to worry about, CZ you just have to copy the given text from here and paste it into PowerShell.

Here, the steps are narrated with a brief explanation. Please follow accordingly:

  • Press Windows+X.
  • Select PowerShell (Admin).
  • Copy the whole text from the box given below, and paste it on the PowerShell terminal.

$totalRam = (Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).Sum

while($true) {

$date = Get-Date -Format “yyyy-MM-dd HH:mm:ss”

$cpuTime = (Get-Counter ‘\Processor(_Total)\% Processor

Time’).CounterSamples.CookedValue

$availMem = (Get-Counter ‘\Memory\Available

MBytes’).CounterSamples.CookedValue

$date + ‘ > CPU: ‘ + $cpuTime.ToString(“#,0.000”) + ‘%, Avail. Mem.: ‘ +

$availMem.ToString(“N0”) + ‘MB (‘ + (104857600 * $availMem / $totalRam).ToString(“#,0.0”) + ‘%)’

Start-Sleep -s 1

}

You will notice that the PowerShell terminal is showing you the CPU and RAM usage continuously with time and date;cpu-and-ram-usage

  • Stop the loop by hitting Ctrl+C – when you want to stop.

This is how you can check your CPU usage continuously. This maybe looks too weird, but the labor is minimum if you follow accordingly.

What is PowerShell?

Usual Windows users are familiar with CMD (command prompt) but PowerShell is a more advanced program that offers advanced command-based automation.power-shell

You can set the automatization of many tasks with customized steps and manage your works and programs easily with PowerShell. It performs at the administration level that you can do whatever is possible with your system. Microsoft developed PowerShell in 2006 to give users more accessibility over the Windows operating system.

In short, PowerShell is a command-line shell and the associated scripting language that is used as a task atomizer and management configurator program.

Are The CMD & PowerShell the Same?

PowerShell works similarly to CMD, but the fundamental differences are simultaneous execution of multiple commands, scripting, OOP (Object Orientation Programming) execution, easy automation, etc.

Surely, CMD is a powerful tool to execute several tasks with direct administrative access. The PowerShell gives the user the flexibility to run more of such scripts at a time, users can even Push GUI (General User Interface) through PowerShell.

Furthermore, PowerShell supports Cross-platform, which is not possible for the CMD.

FAQs

How do I check my computer’s CPU usage?

You can easily look for CPU usage by pressing the combo Ctrl+Shift+Esc, which opens the task manager.

Which language is used in PowerShell?

The PowerShell uses dynamically typed scripting language to operate. You can use C# and python 3, but you can add more.

Conclusion

There is no doubt that PowerShell is one of the most powerful programs, also compatible with multi-platforms. IT experts use such tools to dominate all platforms with one solution, which is the reason the developer community feels comfortable with PowerShell.

Checking a CPU is just child’s play for such users, if not for amateurs. Any advanced task is easily executable with the right direction and guide, as you can notice through this article. If you have more queries, feel free to ask in the comment box below.

About The Author
Farhan Max is a tech geek with a particular interest in computer hardware. He's been fascinated by gaming since childhood and is now completing his undergraduate studies while researching and testing the latest tech innovations. Alongside his love for all things geeky, Farhan is also a skilled photographer.

Leave a Comment