Powershell is widely used in automating simple to complex tasks on Windows and Linux operating systems. Its a object based shell which was launched in 2006. You can save a lot of time by automating repetitive and mundane daily administrative tasks using powershell.
Powershell script contains commands / cmdlets, functions, loops, and logic. After you write a powershell script you can save it in a file with extenstion .ps1. If this is the first time you are running powershell scripts on your windows computer, you may get an error message “File <script path> cannot be loaded because Running scripts is disabled on this system”.
To run a powershell script on your system. Follow below steps:
- Login on your Windows 10 or Windows 11 device.
- Click on Start -> Search for Powershell.
- Open Windows Powershell.
- Provide the path of Powershell script and press Enter.
- You may get below error message after you execute the powershell script.
PS C:\test1> .\Test1.ps1 .\Test1.ps1 : File C:\test1\Test1.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 .\Test1.ps1 FullyQualifiedErrorId : UnauthorizedAccess PS C:\test1> |

How to fix running scripts is disabled on this system error
To Fix running scripts is disabled on this system error, we need to set the Powershell Execution Policy
on your local computer. PowerShell’s execution policy is a safety feature that controls the conditions under which PowerShell loads configuration files and runs scripts. This feature helps prevent the execution of malicious scripts.
Powershell Execution Policy can be set to one of the below five levels:
- Restricted – Execution of powershell scripts is disabled on your system.
- RemoteSigned – Requires digital signature from trusted publisher for scripts downloaded from Internet. Scripts written on the local system does not need to have a digital signature.
- AllSigned – Only scripts which are digitally signed can run.
- Unrestricted – All Powershell scripts can be executed without restriction.
- Bypass – To Bypass the Powershell Execution Policy entirely.
To run powershell scripts on your system, you can set powershell execution policy to either RemoteSigned
or Unrestricted
or you can also use Bypass
to bypass the execution policy and run the scripts on the system.
- On Windows client computers the default Powershell Execution policy is Restricted.
- On Windows Servers the default Powershell Execution Policy is RemoteSigned.
- On non-Windows computers, the default execution policy is Unrestricted and cannot be changed.
Set Powershell Execution Policy to RemoteSigned
To fix “File <script path> cannot be loaded because Running scripts is disabled on this system” error, you can set Powershell execution policy to RemoteSigned
. This is the safest option as this will ensure that only scripts which are digitally signed by trusted publisher will be able to run on your system.
RemoteSigned
is also the default Execution Policy on Windows Servers. Even though setting Remote Signed does not guarantee that your system will be always protected from malicious scripts. Always go through the script and ensure that it does not contain the code which could impact the system.
To Set the Powershell Execution Policy to Remote Signed, Run below command:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
After you execute the command, you will receive the prompt / warning message “Do you want to change the execution policy ?” Type A and press Enter for accepting All warning messages and suppress further prompts. If you prefer not to be prompted then you can use -Force
parameter with the command.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force

Set Powershell Execution Policy to Unrestricted
To fix “File <script path> cannot be loaded because Running scripts is disabled on this system” error, you can set Powershell execution policy to Unrestricted
. This will allow running of powershell scripts on the device without any restrictions.
Even if the powershell script is not digitally signed, setting Powershell execution policy to Unrestricted will allow that script to execute. After you set powershell execution policy to Unrestricted, you need to make sure that powershell script which you are running on your device does not contain any malicious code.
To Set the Powershell Execution Policy to Unrestricted, Run below command:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
After you execute the command, you will receive the prompt / warning message “Do you want to change the execution policy ?” Type A and press Enter for accepting All warning messages and suppress further prompts. If you prefer not to be prompted then you can use -Force
parameter with the command.
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force

Set Powershell Execution Policy to Bypass
To fix “File <script path> cannot be loaded because Running scripts is disabled on this system” error, you can also set Powershell execution policy to Bypass
. This is usually used to run one-off scripts. Bypass switch will bypass the powershell execution policy entirely.
To Set the Powershell Execution Policy to Bypass, Run below command:
powershell -executionpolicy Bypass -File .\Test1.ps1

Where Powershell Execution Policy is stored in Registry
Powershell execution policy is stored in HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell
under a registry entry Executionpolicy
. To check powershell execution policy in windows registry, please follow below steps:
- Login on a Windows device.
- Go to Start and search for Registry Editor.
- Open Registry Editor
- Navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell
- On the right hand side you will find a registry entry called
ExecutionPolicy
which provides the info on the currently set Powershell execution Policy

- You can also get the Powershell execution policy from registry by using below command:
get-itemproperty "HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" -Name executionpolicy | select ExecutionPolicy

Conclusion
In this blog post, we have seen how to fix the error “File <script path> cannot be loaded because Running scripts is disabled on this system” while executing Powershell scripts. This is because of the default execution policy set on windows systems.
However, you can easily change the execution policy on your system by executing a simple command. If you are writing your scripts locally and want to run the scripts on the local computer then its recommended to set the powershell execution policy to RemoteSigned
.
If you are running scripts on a test device and you want to run signed or unsigned scripts downloaded from Internet, then you can set the powershell execution policy to Unrestricted
. I will highly recommend to go through the script contents before executing any script downloaded from Internet to make sure it does not contain any malicious code.