How do you fix running scripts is disabled on this system in PowerShell on Windows 10?

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.

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

When I try to run ionic commands like ionic serve on the VS Code terminal, it gives the following error.

How can I fix this?

ionic : File C:\Users\Lakshan\AppData\Roaming\npm\ionic.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1 + ~~~~~ + CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess

Gino Mempin

20k24 gold badges82 silver badges109 bronze badges

asked Nov 1, 2020 at 15:45

How do you fix running scripts is disabled on this system in PowerShell on Windows 10?

Tharindu LakshanTharindu Lakshan

2,1742 gold badges17 silver badges39 bronze badges

0

I found a way to fix this error.

It is as follows:

  1. First, Open PowerShell with Run as Administrator.
  2. Then, run this command in PowerShell Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
  3. After that type Y and press Enter.

Gino Mempin

20k24 gold badges82 silver badges109 bronze badges

answered Nov 1, 2020 at 15:45

How do you fix running scripts is disabled on this system in PowerShell on Windows 10?

Tharindu LakshanTharindu Lakshan

2,1742 gold badges17 silver badges39 bronze badges

1

This is because of Execution Policy. This defines how powershell scripts will run.

In Default windows desktops, it is Restricted, not allowing any scripts (signed or unsigned) only interactive sessions.

So best is you set using RemoteSigned (Default on Windows Server) letting only signed scripts from remote and unsigned in local to run, but Unrestriced is insecure lettting all scripts to run.

To set run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned as administrator.

answered Nov 1, 2020 at 16:55

How do you fix running scripts is disabled on this system in PowerShell on Windows 10?

To Bypass this you need to change the Execution policy. Type this into your terminal.

Set-ExecutionPolicy -Scope CurrentUser

then it will prompt you to supply a value at which point you can set Bypass / RemoteSigned or Restricted.

cmdlet Set-ExecutionPolicy at command pipeline position 1 Supply values for the following parameters: ExecutionPolicy: "RemoteSigned" or "Bypass" or "Restricted".

answered Sep 27, 2021 at 15:53

How do you fix running scripts is disabled on this system in PowerShell on Windows 10?

This code will fix it:

Set-ExecutionPolicy RemoteSigned –Scope Process

Jeremy Caney

6,38241 gold badges44 silver badges70 bronze badges

answered Apr 27 at 23:23

How do you fix running scripts is disabled on this system in PowerShell on Windows 10?

Not the answer you're looking for? Browse other questions tagged powershell or ask your own question.

How do I enable running scripts in Windows 10 PowerShell?

How to run PowerShell script file on Windows 10.
Open Start..
Search for PowerShell, right-click the top result, and select the Run as administrator option..
Type the following command to allow scripts to run and press Enter: Set-ExecutionPolicy RemoteSigned..
Type A and press Enter (if applicable)..

How do you fix running scripts is disabled?

Solution for “cannot be loaded because running scripts is disabled on this system“:.
Open PowerShell Console by selecting “Run as Administrator” and set the execution Policy with the command: Set-ExecutionPolicy RemoteSigned..
Type “Y” when prompted to proceed..

How do I enable scripts in Windows 10?

* Note: If you still receive the error "Scripts are disabled on this system", give one of the following commands and try again to run your script: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned. set-executionpolicy remotesigned.

How do I enable scripts?

In the Security Settings – Internet Zone dialog box, click Enable for Active Scripting in the Scripting section. When the "Warning!" window opens and asks, "Are you sure you want to change the settings for this zone?" select Yes. Click OK at the bottom of the Internet Options window to close the dialog.