PowerShell “Running script is disabled on this system” Error and Solution

The message Running script is disable on this system is a PowerShell error in order to express that the current Powershell configuration and security policy do not allow to run of scripts on Powershell. PowerShell uses the Execution Policy in order to control and restrict script execution in the PowerShell environment for security reasons. The default execution policy is Restricted which means no scripts can be run directly in PowerShell.

Execution Policy

The PowerShell provides the following execution policies. They are configured for different cases like executing only signed scripts, or not executing any script, etc.

  • Restricted policy is used to prevent any script execution. No scripts can be run in this policy.
  • AllSigned policy is used to run only trusted publisher scripts. The nonsigned script can not be executed in this policy.
  • RemoteSigned policy is used to run only downloaded and trusted publisher signed scripts.
  • Unrestricted policy is used to run all scripts even they are downloaded or not signed. This is the most insecure and relaxed policy for script execution. While setting and using this policy be careful and try to not use this policy.

List Current Execution Policy

The current execution policy can be listed with the commandlet Get-ExecutionPolicy .

Get-ExecutionPolicy

The execution policy is printed with its name like Restricted .

Change Execution Policy to Unrestricted For The Current User

In order to solve the “Running script is disabled on this system error” is solved by changing the execution policy to the Unrestricted . The command Set-ExecutionPolicy is used to set the Unrestricted policy.

Set-ExecutionPolicy -Scope User Unrestricted

Change Execution Policy to Unrestricted For All Users

The execution policy can be change to the Unrestricted for all users in the system. In order to accomplish this the PowerShell terminal should be opened with the Local Administrator or Domain Administrator privileges. This is explained in the following posts.

See also  logoff Command Tutorial
Set-ExecutionPolicy Unrestricted

Bypass Execution Policy For One Time

Another alternative to execute Powershell scripts without any restriction or error is bypassing the current Execution policy. The command powershell can be used with the -ExecutionPolicy option ByPaass and -File option which specifies the PowerShell script.

PowerShell -ExecutionPolicy ByPass -File backup.ps1

Leave a Comment