Home > Windows

PowerShell: cannot be loaded because running scripts is disabled [Fix]

In this guide, we will show you the steps to fix the “cannot be loaded because running scripts is disabled on this system” error in Windows Powershell. Many users have voiced their concern that they are unable to execute any command in Powershell. They have double-checked the command and have also given it the adminsirative level privileges, but the issue is still there. So what’s the reason behind this error? Well, it is due to the security policy put in place by Windows.

cannot be loaded because running scripts is disabled

In its default state, Powershell is not allowed to load, run, or execute any scripts on your computer for security concerns. While that is understandable, what if one wants to execute genuine and legitimate scripts? In such cases, you will have to change its security policy. Once you do so, it should also fix the cannot be loaded because running scripts is disabled on this system” error in Windows Powershell. So without any further ado, let’s get started.

Fix Windows PowerShell: cannot be loaded because running scripts is disabled

cannot be loaded because running scripts is disabled on this system

There exist four different types of security policies for PowerShell- Restricted, Remote Signed, All Signed, and Unrestricted. Out of this, the Restricted Policy is assigned to PowerShell default. So we will have to change it to any of the other three policies. But first, let’s understand what each of these policies means.

  1. Restricted- it will restrict all the scripts from being executed
  2. RemoteSigned- scripts created on your computer would only be allowed to run. Third-party scripts need to be signed before they could be executed.
  3. AllSigned- Only allow the signed scripts to be executed.
  4. Unrestricted- Allows all types of scripts to be executed.

As for this guide, we will be changing the Restricted Policy to the RemoteSigned policy, because it is the most secure of the three. You may also opt for the other two [AllSigned or Unrestricted], but do keep in mind that the latter one [Unrestricted] might prove to be risky, so exercise caution if you are planning to select it.

  1. To begin with, launch PowerShell as an administrator.
  2. Then execute the below command to check your current policy [as of now, it would be Restricted]
    Get-ExecutionPolicy

    cannot be loaded because running scripts is disabled

  3. After that, execute the below command to check the policy status for all the scopes [as of now, it will be Undefined for all]
    Get-ExecutionPolicy -List

    cannot be loaded because running scripts is disabled

  4. Now type in the below command to change the status to RemoteSigned
    Set-ExecutionPolicy RemoteSigned
  5. You will now get a confirmation, press Y to apply the RemoteSigned policy to the Local Machine scope or type in A to apply this policy to all the scopes. As of now, let’s apply it to Local Machine, so type Y and hit Enter.cannot be loaded because running scripts is disabled
  6. Let’s now check the status. So type in the below two commands to get the current policy status
    Get-ExecutionPolicy
    Get-ExecutionPolicy -List
  7. Both these commands will now display the status as Remote Signed. That’s it. You may now execute the desired Powershell script and there will be no errors now.cannot be loaded because running scripts is disabled
  8. If you now wish to change the policy status back to Restricted, then just execute the below command
    Set-ExecutionPolicy Restricted

    cannot be loaded because running scripts is disabled

That’s it. These were the steps to fix the “cannot be loaded because running scripts is disabled on this system” error in Windows Powershell. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.


Share: