Running Scripts is Disabled on this System Error on Powershell


PowerShell, as a management framework may stop running scripts after a while. The running scripts are disabled at that point. You’ll need to code some more scripts or change your execution file. In this post, I would be detailing how you could troubleshoot this problem all on your own.

What is the Running Scripts is Disabled on this System?

The ‘Running scripts is disabled on this system’ is an error that hinders your scripts from running. 

In your PowerShell window, the error would read as follows:

 “Running Script is disabled on this system” or “execution of scripts is disabled on this system” 

Now you know what the error is, let’s move on to see what could be causing the problem.

What causes the Error?

Every script that runs on the PowerShell should have to be verified from several trusted sources before it is allowed to run. However, in some cases, even if the script has verification, it is still stopped from executing.  

This happens because the Windows OS on which the PowerShell runs has an “Execution Policy”. Before any script is run, the script needs to bypass this “Execution Policy”, for it to be executed. If this Execution Policy is set to “Restricted”, then no script can be run on your computer. 

Below is the list of different execution policies in PowerShell:

Restricted: No scripts can be run

This is the default execution policy in Windows 8, Windows Server 2012, and Windows 8.1. It Permits individual commands, but will NOT run scripts. It prevents the running of all script files. This includes formatting and configuration files (.ps1xml), module script files (.psm1), and Windows PowerShell profiles (.ps1).

All Signed

Powershell allows only scripts signed by a trusted publisher to run. Powershell requires that all scripts and configuration files be signed by a trusted publisher, including scripts that you write on your local computer. It prompts you before running scripts from publishers that you have not yet classified as trusted or untrusted.

With it, you risk running signed, but malicious, scripts.

RemoteSigned

All downloaded scripts must have a signature from a trusted publisher. This is the default execution policy for Windows Server 2012 R2. It requires a digital signature from a trusted publisher for scripts and configuration files that were downloaded from the Internet.

It does not require digital signatures written on yo machine. It allows unsigned scripts downloaded from the Internet if the scripts are unblocked, such as by using the Unblock-File cmdlet. It allows for unsigned scripts from sources other than the Internet and signed, but malicious, scripts, to be run.

Unrestricted

 All possible Windows PowerShell scripts can be run. Unsigned scripts will also run. (This means malicious scripts can also run). You’ll get a warning before running scripts and configuring files that are downloaded from the Internet.

Bypass

No scripts are blocked from running, and you also have no warnings or prompters. This execution policy works best in situations in which a Windows PowerShell script is built into a larger application. It also works in situations in which Windows PowerShell is the foundation for a program that has its security model.

Undefined

This occurs when there is no set execution policy in your current scope. If the execution policy in all your scopes is undefined, then the effective execution policy is Restricted. Now, let’s move on to the solutions, starting from temporary and moving towards permanent.

Fix the Running Scripts is disabled on this System on PowerShell Error?

Solution 1: Add Some Extra Code to Your Script

If you intend running a particular script on your computer and you don’t want to go through the hassle. You may not need to change the execution policy, as you can always add a piece of code to the command you want to run.

With this, the script would gain access through the policy. 

To do this, follow the following steps:

Step 1: Simultaneously, press “Windows” + “R” to open the Windows run prompt.
Step 2: Type in “PowerShell”, then simultaneously press “Shift” + “Ctrl” + “Enter”, to activate administrative privileges.
Step 3: Type in the command and execute a particular script like the following command: 

“c:\> powershell -ExecutionPolicy ByPass -File script.ps1”

Note: This will allow that particular command to escape the Execution Policy. The downside to this solution is that you need to repeat this process for every command. Which is why the next method is recommended.

Solution 2: Change the Execution Policy

The execution policy provides access to the PowerShell to run a script. So, when it is set to restricted, it will block all scripts from being executed.

Since you now know the levels to which the execution policy can be set to, you can easily choose the best one for you, depending upon your requirements. To change the execution policy, you need to:

Step 1: Simultaneously, press “Windows” + “R” to open the Windows run prompt.

Step 2: Type in “Powershell”, then simultaneously press “Shift” + “Ctrl” + “Enter”, to activate administrative privileges.

Step 3: Type in the following command and execute it by pressing “Enter”:

“Set-ExecutionPolicy RemoteSigned”

Step 4: Press “Y” to indicate Yes.  This will change the Group Policy to the desired level.

Note: The word “Remote Signed” in the above code is to be replaced with the security level that you want as indicated above.

Check to see if the issue persists.

Conclusion

In all, you may be unable to run scripts in your Windows PowerShell. You can fix it by coding a new script or change your execution file.  I have detailed the step by step process in this post for you.

However, if this doesn’t work for you then you should just contact Microsoft Support center. It may be a problem from their end. 

Roman Markovich

My Name is Roman Markovich. I been IT professional for the last 10 years. I am was hoping to establish to help many users with OS errors. I hope you will enjoy our content.

Recent Content