How to Check CPU Usage Using PowerShell [Script Added]

Written By Farhan Max

Multi-platform supported programs like PowerShell are impactful tools to rule many operating systems together.

I’ve overcome numerous troubles, errors, exceptions, and situations only with PowerShell while dealing with computers of mine and others.

check-cpu-usage-using-powershell

Some use cases require ridiculous ways to fix or operate, where PowerShell is the only tool to rely upon. Thus, monitoring CPU usage using PowerShell is child’s play.

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 a complicated process to check CPU utilization, but there are certain circumstances when a user would require such a crazy process to detect & fix high CPU usage. You can take a virus-infected system, for example.

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 simple task 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 passing the code one time. You can paste the code several times to see the CPU load as needed, or you can check the following method up next.

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 cause 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. Maybe it 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

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

In short, PowerShell is a command-line shell and the associated scripting language 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, system automation, etc.

Whereas, 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.

Along with administrative access, CMD can create folders and similar usual tasks easily with simple commands.

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?

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

Conclusion

PowerShell is undoubtedly one of the most powerful programs, also compatible with multi-platforms. Especially IT experts use such tools to dominate all platforms with one solution, which is why the developer community feels comfortable with PowerShell.

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