PowerShell is a great tool for Windows system administration created by Microsoft. You can run command lines to automate the operating system.
This is a new tool that comes with Windows 10 and has many functionalities. However, these features come with several issues.
Many users encountered the error message “running of scripts is disabled on this system”.
Therefore, the PowerShell execution policy doesn’t allow running scripts. Also, the same error appears when trying to run a PowerShell script.
This is a major issue that makes the PowerShell unusable. Fortunately, there are some solutions available and today we will show you what to do if you encounter the “running of scripts is disabled on this system” error in PowerShell.
Can’t run scripts in PowerShell? Here’s the fix
Change the PowerShell execution policy
By default, the PowerShell execution policy is set to Restricted. You can change that by setting policy to RemoteSigned.
So, change the execution policies with Set-ExecutionPolicy cmdlet. It should be like this:
PS C:> Set-ExecutionPolicy RemoteSigned
Also, you can use the following command:
PS C:> get-executionpolicy
You can bypass the command above by adding this script:
c:> powershell -ExecutionPolicy ByPass -File script.ps1
As you can see, by typing some commands you can fix the “running of scripts is disabled on this system” error in PowerShell.
It is worth mentioning that PowerShell has four different execution policies:
Restricted – you can’t run scripts.
AllSigned – you can run only the scripts signed by a trusted publisher.
RemoteSigned – you can run downloaded scripts that a trusted publisher signed.
Unrestricted – you can run all Windows PowerShell scripts.
Also, keep in mind that PowerShell has the Restricted execution policy set as default. The reason is to stop people from executing commands found on the Internet. As we all know, some scripts can damage your computer.
So, before you change the execution policy, check your script and search for additional information about it. This way, you will make sure everything is safe before running the command in PowerShell.
Did our solution help you? What scripts do you run in PowerShell? Do let us know in the comments section below!
RELATED ARTICLES YOU NEED TO CHECK OUT: