Fixed .ps1 cannot be loaded because running scripts is disabled

In this blog I will share how to Fix .ps1 cannot be loaded because running scripts is disabled on this system error when trying to run script on the PowerShell application.

 

When we try to run script it gives the error, Script cannot be loaded because running scripts is disabled on this system:

 

Fixed .ps1 cannot be loaded because running scripts is disabled

Steps to Fix .ps1 cannot be loaded because running scripts is disabled error in PowerShell:

Run windows PowerShell as an Administrator:

 

Fixed .ps1 cannot be loaded because running scripts is disabled

Once opened with admin rights it should look like this:

 

Fixed .ps1 cannot be loaded because running scripts is disabled

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

 

We will check what is the script execution policy set on the affected computer:

 

Run the following command in the PowerShell window, to know the current script execution mode set on 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, I can allow it for everyone logging on the computer or just myself by running the below command respectively:

 

To allow everyone logging on the computer be able to run script, run the following command:

Set-ExecutionPolicy RemoteSigned

 

Fixed .ps1 cannot be loaded because 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.

 

To allow only your account logged on the computer be able to run script, run the following command:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

 

Fixed .ps1 cannot be loaded because 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 allows it to run the script or files which are signed by trusted publisher.

 

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

 

Set-ExecutionPolicy Unrestricted

 

Fixed .ps1 cannot be loaded because 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 accordingly 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 are getting any error in setting it or want to set it for your user account only, then you can run the below:

 

Set-ExecutionPolicy Unrestricted -Scope CurrentUser

 

Fixed .ps1 cannot be loaded because running scripts is disabled

In conclusion to fix .ps1 cannot be loaded because running scripts is disabled error run the command Set-ExecutionPolicy RemoteSigned before running script.

 

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

 

Date: 11/03/2023

Author: Prem

Tags: Fix .ps1 cannot be loaded because running scripts is disabled

Leave a Comment

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