sodcalculator

10 Tech How-To

Fix Windows Cannot Find PowerShell Exe

Guide 10-7442 · Updated · Step by step

If Windows says it cannot find PowerShell.exe, the fix is usually one of three things: restore the correct PowerShell path, repair the Windows environment variables, or reinstall PowerShell itself. This article walks through each fix in order, from the quickest check to the most thorough solution, so you can get PowerShell running again.

Why Windows Cannot Find PowerShell.exe

PowerShell.exe is a standard Windows component located in C:\Windows\System32\WindowsPowerShell\v1.0\ (for Windows PowerShell 5.1) or in the WindowsApps folder for PowerShell 7+. When Windows reports it cannot find the executable, it usually means one of the following:

  • The PATH environment variable no longer includes the folder where PowerShell.exe lives.
  • The file itself was deleted, moved, or corrupted by a cleanup tool, a manual mistake, or a failed update.
  • A shortcut or script is referencing an old or incorrect location.
  • Windows is looking for a file named powershell.exe in the current directory or in a folder that no longer contains it.

Understanding which case applies to you will determine the fastest fix. The steps below start with the simplest checks and move to more involved repairs.

Quick Checks Before You Repair

Before diving into environment variables or reinstallation, try these quick checks. They take under a minute and can save you a lot of time.

  1. Open the correct folder manually. Press Win + R, type C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe, and press Enter. If it opens, the file exists and the problem is likely the PATH variable.
  2. Try PowerShell from the Start menu. Click Start, type “PowerShell�, and see if it appears in the results. If it does, right-click and select “Run as administrator�. If it launches, the issue is limited to certain shortcuts or scripts.
  3. Check for multiple installations. If you have PowerShell 7 installed, it lives in C:\Program Files\PowerShell\7\pwsh.exe. The executable name is pwsh.exe, not powershell.exe. If a script is calling powershell.exe but only PowerShell 7 is installed, Windows won’t find it.

If none of these work, move on to the environment variable fix.

Fix the PATH Environment Variable

The most common cause of “Windows cannot find PowerShell.exe� is a missing or broken PATH entry. The PATH variable tells Windows which folders to search when you type a command. If the System32\WindowsPowerShell\v1.0 folder is missing from PATH, Windows won’t find PowerShell when you type powershell in Run or Command Prompt.

To check and fix PATH:

  1. Press Win + R, type sysdm.cpl, and press Enter.
  2. Go to the Advanced tab and click Environment Variables.
  3. Under System variables, find and select Path, then click Edit.
  4. Look for an entry that says C:\Windows\System32\WindowsPowerShell\v1.0\. If it’s missing, click New and paste that exact path.
  5. Also check that C:\Windows\System32 is present. It usually is, but if it’s missing, add it as well.
  6. Click OK on all windows, then restart Command Prompt or the app that was failing.

If you’re comfortable with the command line, you can also add the path using setx in an elevated Command Prompt:

setx /M PATH "%PATH%;C:\Windows\System32\WindowsPowerShell\v1.0\"

Note that setx has a 1024-character limit, so if your PATH is already long, use the GUI method instead.

Repair or Reinstall PowerShell

If the executable file is missing or corrupted, fixing PATH won’t help. Windows PowerShell is a built-in component, so you can repair it using the Windows Features tool or DISM.

Option 1: Enable/Disable Windows PowerShell Feature

  1. Press Win + R, type optionalfeatures.exe, and press Enter.
  2. Scroll down to Windows PowerShell 2.0 and uncheck it. Click OK and restart if prompted.
  3. Reopen optionalfeatures.exe, re-check the same box, and click OK. This forces Windows to reinstall the PowerShell components.

Option 2: Use DISM to Restore System Files

If the feature toggle doesn’t work, run DISM to check for corruption:

  1. Open an elevated Command Prompt (search “cmd�, right-click, “Run as administrator�).
  2. Run DISM /Online /Cleanup-Image /RestoreHealth. This may take several minutes.
  3. Then run sfc /scannow to repair system files.
  4. Restart and try PowerShell again.

Option 3: Install PowerShell 7

If Windows PowerShell 5.1 is beyond repair, you can install PowerShell 7 (which runs side-by-side). Download it from the official Microsoft GitHub releases page. After installation, you’ll have pwsh.exe in C:\Program Files\PowerShell\7\. You can add that folder to PATH to use pwsh from anywhere. Note that scripts written for Windows PowerShell 5.1 may not run unchanged in PowerShell 7, so test them first.

Common Mistakes That Break PowerShell

Several routine actions can cause this error. Knowing them helps you avoid repeating the mistake:

  • Using a “cleanerâ€� tool that removes registry entries or files it thinks are unnecessary. Many such tools mistakenly delete PowerShell files.
  • Manually deleting files from System32 to free space. Never delete anything from System32 unless you are absolutely sure.
  • Editing PATH incorrectly – overwriting the entire variable instead of appending to it. This removes all default paths, including the one for PowerShell.
  • Installing only PowerShell Core and expecting the old powershell.exe command to work. The two are separate executables.
  • Running a script that changes the current directory and then calling powershell.exe without a full path. If the script’s folder doesn’t contain the executable, Windows won’t find it.

How to Verify the Fix Worked

After applying any of the fixes above, verify that PowerShell is working correctly:

  1. Press Win + R, type powershell, and press Enter. A blue console window should open.
  2. In that window, type $PSVersionTable.PSVersion and press Enter. You should see a version number like 5.1.22621.2506.
  3. If you installed PowerShell 7, type pwsh instead. You should see a version like 7.4.2.
  4. If you still get “cannot find�, open an elevated Command Prompt and run where powershell.exe. It should return a path. If it returns nothing, the PATH fix didn’t take effect – restart your computer and try again.

Frequently Asked Questions

Why does Windows say “cannot find powershell.exe� when I run a script?

This usually means the script is calling powershell.exe but the PATH variable doesn’t include the folder where it lives. The script might also be using a relative path. Check the script’s code for the exact command and replace it with the full path to the executable, or fix the PATH as described above.

Can I just copy PowerShell.exe from another computer?

It’s not recommended. PowerShell depends on many other system files and registry entries. Copying just the exe from another machine often leads to other errors. Instead, use the Windows Features repair or DISM to restore the component properly.

What’s the difference between powershell.exe and pwsh.exe?

powershell.exe is Windows PowerShell 5.1, the built-in version that ships with Windows. pwsh.exe is PowerShell 7+, a separate cross-platform version you install manually. They can coexist, but they are different programs with different paths.

Will reinstalling Windows fix this?

Yes, but it’s a last resort. A full reinstall will restore all system files, including PowerShell. However, you lose installed programs and settings unless you back them up. Try the DISM and SFC fixes first – they solve most corruption issues without a reinstall.

Why does PowerShell work in one user account but not another?

This points to a user-specific PATH variable issue. Check the user’s PATH under Environment Variables (not the system variables). A missing entry there can cause the error only for that user. Add the same path to the user variable to fix it.

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

The whole Tech How-To bed →