Fix Script cannot be loaded because running scripts is disabled

Hi everyone this is Prem, I have worked as Microsoft 365 Support Ambassador. In this blog I will share how to Fix Script cannot be loaded because running scripts is disabled on this system error when trying to run script file on the PowerShell.

 

This issue occurs on windows computer when we try to run script it gives the error Script cannot be loaded because running scripts is disabled on this system:

 

 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at

In order to fix this please follow the steps below:

 

Steps to Fix Script cannot be loaded because running scripts is disabled on the system error in PowerShell:

Open PowerShell on which you are trying to run the script, as an Administrator:

 

 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at

Once opened it should look like this:

 

 Fix Script cannot be loaded because running scripts is disabled. For more information, see about_Execution_Policies at

Or you can open any PowerShell which you were trying to run the Script file on.

 

Before running the script check what is the execution policy setup on your computer, by default it is set to block script execution on the computer to protect it.

 

Run the following command in the PowerShell window open, to know the current script execution mode of your computer:


Get-ExecutionPolicy

 

The output of the above command will look something like this:


Fix Script cannot be loaded because running scripts is disabled

For my computer it is set to Restricted, Now I can allow it for everyone using the computer or just myself by running the below command respectively:

 

To allow everyone using the computer be able to run script without the error “Script cannot be loaded because running scripts is disabled on this system” run the following command:

Set-ExecutionPolicy RemoteSigned


loaded because running scripts is disabled on this system

After you run the above command you will be prompted to confirm the changes, you can type A as shown above or Y. This will set the policy and you should then be able to run the script.

 

To allow only your account using the computer be able to run script without the error “Script cannot be loaded because running scripts is disabled on this system” run the following command:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

 

 running scripts is disabled

After you run the above command you will be prompted to confirm the changes, you can type A as shown above or Y. This will set the policy and you should then be able to run the script.

 

Setting the execution policy as RemoteSigned allow it to run the script or files which are signed by trusted publisher.

 

After running the above if you are not able to run the scripts still and get the same error then you can run the below command:

 

Set-ExecutionPolicy Unrestricted

 

running scripts is disabled

After you run the above command you will be prompted to confirm the changes, you can type A as shown above or Y. This will set the policy and you should then be able to run the script.

 

The above command remove all the restriction of running script on your computer.

If you want to do it for your user account only then you can run the below:

 

Set-ExecutionPolicy Unrestricted -Scope CurrentUser

 

Fix Script cannot be loaded because running scripts is disabled

After you are done with running the script you can change the setting back if you want, to go back to default run the command:

 

Set-ExecutionPolicy Restricted

 

Fix Script cannot be loaded because running scripts is disabled

As it was Restricted in my case when we checked initially with the Get-ExecutionPolicy command.

 

If you have any question please drop it in the comment section below.

 

Date:24/02/2023

Author: Prem

Tags: Fix Script cannot be loaded because running scripts is disabled

Leave a Comment

Your email address will not be published. Required fields are marked *