How to fix Powershell error: Running scripts is disabled on this system

In order to prevent malicious programs or more precisely scripts from being executed in an improper way on your system, Powershell security policy triggers the error: Running scripts is disabled on this system. All the scripts which are not signed willalso be blocked. In such circumstances, the execution policy is set as ‘Restricted’ which is the default mode.

In order to modify these policies, you can use the cmdlet Set-ExecutionPolicy.

Read: An introduction to Windows PowerShell for beginners

To check first the current active policy, you may want to run the cmdlet Get-ExecutionPolicy as follows:

c:/> Get-ExecutionPolicy

This will return the code: Restricted

Now execute the cmdlet:

c:/> Set-ExecutionPolicy RemoteSigned

For your information, here are the types of permissions that you can use with this cmdlet:

Read: Linux Bash usage tips

Restricted

It does not run any Powershell configuration scripts and/or files .

All Signed

It only executes configuration scripts and/or files that are only signed by a trusted publisher.

Remote Signed

Local or custom scripts must be signed beforehand by a trusted publisher.

Unrestricted

Loads and executes all PowerShell configuration scripts .

 


If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.

 

Nikolaus Oosterhof

Nikolaus holds a degree in software development and has a strong passion for all things tech-related, especially gadgets with screens. Though he is nostalgic for older phone models, he's a retired gamer and continues to enjoy programming in open-source environments. Additionally, Nikolaus enjoys writing about Linux, macOS and Windows and has experience designing web pages.

Leave a Reply