[Fixed] Powershell running scripts is disabled on this system – Windows 11/10

69 / 100

If you get ‘PowerShell running scripts is disabled on this system’ error message when you try to run a PS script even as the Administrator, you are at the right place to find out how to solve it.

For security reasons, the script execution is blocked by default. The PowerShell execution policy controls it.

running-scripts-disabled-error-1

How to Solve?

By default, the PowerShell execution policy is set to restricted. We can unstrict the policy to run the scripts without the above error.

Execute the following command in PowerShell (Open it as Administrator)

set-ExecutionPolicy RemoteSigned

Now, run the same script which was not working earlier. That should work.

Working-Script

There are a few options/keys you must know while editing this policy.

  • Restricted -- No scripts can be run.
  • AllSigned -- Only scripts signed by a trusted publisher can be run.
  • RemoteSigned -- Downloaded scripts must be signed by a trusted publisher. This is the ideal option in most cases.
  • Unrestricted -- No restrictions; all Windows PowerShell scripts can be run. If none of the above options works, then you can try ‘Unrestricted.’

For more information, check the Microsoft guide here.

To find out what type of PowerShell execution policy is in place on your Windows 11/10 computer, run the below command.

Get-ExecutionPolicy

Microsoft recommends disabling the PowerShell script running policy after completing purposeful manual script execution. It is one of the best security practices on Windows client or Server operating systems.

So, it is better to restrict it again.

To do it, run the below command.

Set-ExecutionPolicy -ExecutionPolicy Restricted

Now check the status.

restrict-the-policy-again

It will show as restricted. So, when you run the earlier script, you will get the same error now.

same-error-now

If you want to run a single PowerShell script, then you can bypass the existing restriction.

Here is the command to do that.

powershell -ExecutionPolicy Bypass -File script.ps1
bypass-option

As you can see, it ran successfully without modifying the existing policy.

In this article, we showed how to enable the Powershell execution policy to run the scripts and avoid the “cannot be loaded because running scripts is disabled on this system” error. Also, it is recommended to set back the policy to default settings once we complete running the required PowerShell scripts.

Stefan Richard is one of the folks who can't have a life without technology, especially Microsoft products. He has more than 12+ experience in Information technology. He worked as IT trainer, network/system administrator and IT Infrastructure manager. Stefan is the co-founder of HecticGeek.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Shares
Tweet
Share
Share
Pin