In addition to system management and administration, PowerShell is often used to troubleshoot various issues in Windows. But if PowerShell itself isn’t working properly, troubleshooting can be a handful.
Generally speaking, most PowerShell issues occur due to misconfigured settings. Problems with specific modules are also very common, mostly due to a corrupt module store.
In this article, we’ve listed step-by-step instructions for resolving these and more PowerShell issues.
Why Is PowerShell Not Working?
- No admin privileges
- PowerShell is disabled
- Misconfigured group policies
- Corrupt PowerShell files
- Misconfigured / corrupt user account
- Background service conflict
- Buggy Windows version
How to Fix PowerShell Not Working?
Before you start troubleshooting, we recommend running PowerShell as administrator from the following location:%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
.
Replace system32 with syswow64 for the x86 version.
For minor errors such as Access Is Denied, the item you selected is unavailable, or this file does not have an app associated with it for performing this action, this could be all that’s needed to fix the issue.
Restart PC (Special Case)
After an in-place upgrade of Windows 10 S, you may encounter the Your organization used Device Guard to block this app error when launching PowerShell.
This error occurs because of a policy that prevents Windows 10 S from controlling Win32 apps. This restriction should normally be cleared during the upgrade, but in case it’s not, you can clear it by restarting the PC a few times.
Enable PowerShell via Windows Features
You may be facing issues with PowerShell because it’s disabled in the Windows Features utility. Here’s how you can enable PowerShell in such cases:
- Press Win + R, type
optionalfeatures
, and press Enter. - Make sure the box next to Windows PowerShell is checked to enable it, and press OK.
Modify Group Policy and Registry
Misconfigured group policy settings could also be the reason why PowerShell isn’t working. For instance, users have encountered error messages such as “This operation has been canceled due to restrictions in effect on this computer. Please contact your system administrator.”
Here’s what you can do to check if this is the issue:
- Press Win + R, type
gpedit.msc
, and press Enter. - Navigate to User Configuration > Administrative Templates > System.
- Double-click the Don’t run specified Windows applications policy and set it to Not configured, and press OK.
- Restart your PC and test if PowerShell works properly now.
Modify Execution Policy
When attempting to run a script that isn’t digitally signed, you may face errors due to the execution policy. We have a detailed article on changing the execution policy for your further reading, but here are the main steps:
- Press Win + R, type
powershell
, and press CTRL + Shift + Enter. - Execute the following command:
Set-ExecutionPolicy RemoteSigned -Force -Scope LocalMachine
- Do note that you have to change the set execution policy separately for the 32-bit and 64-bit versions.
Update / Reinstall PowerShell Framework
Another reason for errors in PowerShell is that the PowerShell files, commonly the module store for instance is corrupted. In such scenarios, you can execute the following command to update the PowerShell framework:
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
If PowerShell isn’t launching at all or something similar, you can take the following steps instead to update/reinstall it via the GUI instead:
- Download the x64 version or x86 version as appropriate for your system.
- Launch the PowerShell Installer and follow the on-screen instructions.
- If you’d like to install a different PowerShell version, you can find all the releases on the PowerShell GitHub page.
Try Using Different Account
Although uncommon, misconfigured settings and other issues with the current user account you’re on could also be preventing PowerShell from working properly. In such cases, users have had success with switching to a different user account.
We recommend enabling the default administrator account to check if this is indeed the problem in your case. Here are the steps to do so:
- If Command Prompt works, execute the following command in CMD and skip ahead to Step 5.
net user administrator /active:yes
- Alternatively, press Win + R, type
lusrmgr.msc
, and press Enter. - Open Users and double-click Adminstrator.
- Uncheck the Account Is Disabled option and press OK.
- The admin account should be accessible now. Log into it and test if PowerShell works. If it does, the issue is with the previous account. You can try the solutions listed below to fix the corrupt account. If that doesn’t work, you’ll ultimately need to backup your user files and migrate to a new account.
Perform a Clean Boot
Background conflicts with third-party apps (usually antiviruses), or even some Microsoft services could be the reason why PowerShell isn’t working. To test this, you can clean boot with only the core services and check if PowerShell works then. Here are the steps to do so:
- Press CTRL + Shift + Esc and switch to the Startup tab in the Task Manager.
- Disable all unnecessary startup programs, especially ones that you suspect might be causing the issue.
- Press Win + R, type
msconfig
, and press Enter. - Switch to the Services tab and enable the Hide all Microsoft services checkbox.
- Click on Disable All and press OK.
- Restart your PC and test if PowerShell works now.
- If it works, you can enable the service that you think is causing the issue, restart, and check if it being enabled affects PowerShell. By repeating this process, you can eventually figure out the culprit.
- If PowerShell doesn’t work despite clean booting, the issue is likely something else. In this case, repeat Steps 3 – 5 but enable the services this time to resume booting normally.
Use System Repair Utilities
As stated, file corruption is a common reason for such issues in Windows, and PowerShell is no exception. We recommend using the CHKDSK, SFC, and DISM utilities to scan for and repair any corruption. Here’s how you can do so:
- Press Win + R, type cmd and press CTRL + Shift + Enter.
- Type
chkdsk C: /f /x /r
and press Enter. - If CheckDisk reports any issues, you can troubleshoot for that specific problem. Otherwise, execute the following commands next:
DISM /Online /Cleanup-Image /Restorehealth
Sfc /Scannow
If Command Prompt isn’t working either, you can boot into safe mode and try using the aforementioned utilities there.
Update Windows
There have been multiple cases in the past where various Windows components including PowerShell stopped working after an update. Numerous users faced this particular issue after an antimalware update, for instance.
Problems like this get patched pretty soon, so if you encountered this issue after an update, the best thing to do is to install the new update when it comes out. Automatic Updates are enabled on most PCs, but just in case, here’s how you can do so manually:
- Press Win + I and select Windows Update.
- Press the Check for Updates button. Download and install the update if available.
How to Fix PowerShell Modules Not Working?
PowerShell modules are located in the following directories:C:\Program Files\WindowsPowerShell\Modules
C:\Windows\System32\WindowsPowerShell\v1.0\Modules
Most often, the files in these directories get corrupted which leads to issues with the modules. If a specific module is not working in PowerShell, updating or reinstalling it fixes the issue in most cases. Here’s how you can do so:
- Press Win + R, type
powershell
, and press CTRL + Shift + Enter. - Type
Get-Module -ListAvailable
and note the name of the module you’re trying to update or reinstall. - To update the module, execute the following command:
Update-Module -Name ModuleName
- To uninstall the module, execute the following commands:
Uninstall-Module -Name ModuleName
Install-Module -Name ModuleName