If Windows PowerShell is causing high CPU usage, the fix usually involves identifying and stopping a runaway script or process, then repairing or reconfiguring PowerShell itself. Start by opening Task Manager to see which PowerShell process is consuming CPU, then follow the steps below to resolve the most common causes.
Why PowerShell Uses High CPU
PowerShell is a legitimate Windows component used for automation and system administration. High CPU usage typically comes from one of three sources: a scheduled task running a script, a background process that calls PowerShell (like Windows Update or a third-party app), or a script that is stuck in an infinite loop. In rare cases, malware disguises itself as PowerShell, but the steps below cover both benign and malicious scenarios.
Step 1: Identify the Culprit in Task Manager
- Press Ctrl+Shift+Esc to open Task Manager.
- Go to the Processes tab and click the CPU column header to sort by usage.
- Look for any entry named Windows PowerShell or powershell.exe. Note its CPU percentage and the command line if visible.
- If you see multiple PowerShell processes, right-click each and select Go to details to see the exact executable.
If the process is using 30% or more CPU consistently, it’s likely running a script. If you don’t recognize the script or the process appears suddenly, treat it as suspicious.
Step 2: End the Problem Process
If you need immediate relief, right-click the PowerShell process in Task Manager and select End task. This will stop the script and free up CPU, but it won’t prevent the process from restarting if it’s triggered by a scheduled task or a service. After ending the process, watch to see if it returns.
Step 3: Check Scheduled Tasks and Startup
PowerShell scripts often run via Task Scheduler. To find and disable them:
- Press Win+R, type
taskschd.msc, and press Enter. - In the Task Scheduler window, click Task Scheduler Library on the left.
- Look for tasks with Actions that run
powershell.exeorpwsh.exe. Check the Triggers tab to see when they run. - If a task is running frequently and you didn’t create it, right-click and select Disable or Delete.
Also check startup programs: open Settings > Apps > Startup and disable any entry that references PowerShell. Some third-party tools (like hardware monitoring utilities) launch PowerShell at boot and keep it running.
Step 4: Inspect the Script or Command Line
If you can see the command line of the offending process (in Task Manager’s Details tab, right-click the column headers and enable Command line), you can often tell what script is running. For example, a command line like powershell.exe -ExecutionPolicy Bypass -File C:\Temp\scan.ps1 points to a specific script. If the script is yours and it’s stuck in a loop, open it in PowerShell ISE or Visual Studio Code and look for while ($true) or a ForEach loop that never ends. Add a break condition or a timeout.
If the command line is empty or shows only powershell.exe with no arguments, it might be a legitimate system process. In that case, proceed to the repair steps below.
Step 5: Run System File Checker and DISM
Corrupted system files can cause PowerShell to misbehave. Run these commands in an elevated Command Prompt (not PowerShell, to avoid interference):
- Press Win+X and select Command Prompt (Admin) or Windows Terminal (Admin).
- Type
sfc /scannowand press Enter. Wait for the scan to finish. - If SFC finds issues, run
DISM /Online /Cleanup-Image /RestoreHealthand press Enter. - Restart your PC after both commands complete.
These tools repair Windows system files and can resolve underlying issues that cause PowerShell to spin.
Step 6: Scan for Malware
If PowerShell is running scripts without your knowledge, it could be a sign of malware. Run a full scan with Windows Defender (or your preferred antivirus). To do a thorough scan:
- Open Windows Security from the Start menu.
- Go to Virus & threat protection and click Scan options.
- Select Full scan and click Scan now.
If malware is found, remove it and then check if CPU usage returns to normal. For stubborn infections, consider using the offline scan option.
Step 7: Update or Reinstall PowerShell
Outdated versions of PowerShell can have bugs that cause high CPU usage. Windows PowerShell 5.1 is built into Windows and updated via Windows Update. To update it, go to Settings > Windows Update and check for updates. For PowerShell 7 (a separate install), you can download the latest version from the official GitHub releases page (but avoid third-party sites). If the problem persists, you can reinstall PowerShell 7 by uninstalling it from Settings > Apps and reinstalling the latest version.
Frequently Asked Questions
Why does PowerShell use 100% CPU but no window is open?
PowerShell can run in the background without a visible window, especially when launched by a scheduled task or a service. Check Task Scheduler and the Services console (press Win+R, type services.msc) for any service that invokes PowerShell. If you find one, stop the service or change its startup type to Manual.
Can I disable PowerShell entirely to stop high CPU usage?
Disabling PowerShell is not recommended because Windows itself uses it for many maintenance tasks. Instead, disable specific scheduled tasks or scripts that are causing the problem. If you have a legitimate need to block scripts, you can set the execution policy to Restricted via Group Policy, but that won’t stop system processes.
Is high CPU usage from PowerShell a sign of a virus?
Not always, but it can be. Malware often uses PowerShell to download and run payloads. If the command line contains suspicious URLs or encoded strings, treat it as a threat. Run a full antivirus scan and consider using a second-opinion scanner like Malwarebytes.
What if the CPU usage is from a script I wrote myself?
Your script may have an infinite loop or a very long-running operation. Add a counter or a timeout to break the loop. For example, use Start-Sleep to slow down polling, or use a for loop with a maximum iteration count. Test the script with a small dataset first.
Will resetting Windows fix PowerShell high CPU usage?
Resetting Windows (via Settings > System > Recovery > Reset this PC) will remove all installed apps and settings, which can eliminate any problematic scripts or services. However, it’s a drastic step. Try all other fixes first, and back up your data before resetting.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Fix Unfortunately App Has Stopped: Step-by-Step
- Restart a Frozen Samsung Galaxy A12
- HomePod Stereo Pair with AirPlay 2 from iPhone
- Fix 0x8e5e0247 Error on Windows
- Pixel & Pixel XL No Sound: Solved?
- How to Edit Playlists on iPhone