.single .post-author, .post-date {
text-transform: none;
}
,
Last updated: February 15th, 2024
In Windows 10/11, the error message “script cannot be loaded because running scripts is disabled on this system” occurs when you try to run a PowerShell script but the operating system has restricted script execution for security reasons.
The default PowerShell execution policy is a security feature that prevents malicious scripts from running. However, if you are trying to run a script that you or someone else has created and it is not malicious, you can override this security policy by allowing the script to run by following the instructions below.
But before proceeding to change the Execution Policy of running scripts, is good to know the all the types of the execution policies:*
- Restricted: This is the default policy for Windows clients and prevents running any scripts.
- RemoteSigned: This policy allows to run scripts written on the local computer but prevents the execution of scripts that are downloaded from the internet and they are not signed.
- AllSigned: This policy allows you to run only scripts signed by a trusted publisher, including scripts that you write on the local computer.
- Unrestricted: This policy allows to run all scripts (signed or unsigned), but puts your computer under security risks.
- Default: Sets the default execution policy, which is “Restricted” for Windows clients & “RemoteSigned” for Windows servers.
* Source: Microsoft: About Execution Policies.
How to FIX: Running scripts is disabled on this system on Windows 11/10.
On a Windows computer, you can change the default execution policy for a specific session or script, for all scripts, for the current user, or for all users on the computer via Windows Settings, PowerShell or Group Policy.
- Allow Scripts to Run in Windows 11 Settings.
- Allow Scripts Execution in PowerShell.
- Permit Scripts to Run in Group Policy.
- Check Current Execution Policy in PowerShell.
- Reset Execution Policy to Default from PowerShell.
Method 1. FIX “Running Scripts is disabled” in Windows 11 Settings.*
* Note: This method applies only to Windows 11. For Windows 10, skip to next methods.
1. Go to Start > Settings and open Privacy and security*
2a. In Privacy and Security settings, click For developers.
2a. Scroll down and then expand the PowerShell options.
2c. Turn On the Change the execution policy to allow local PowerShell scripts to run without signing. Require signing for remote scripts.
Method 2. FIX: Running Scripts is disabled in PowerShell (Windows 10/11).
To change the execution policy through PowerShell, use these instructions:
1. Bypass “Running scripts is disabled” error for the current session.
If you want to bypass the default script execution policy only for the specific session, give the following command and then execute your script:
- Powershell -ExecutionPolicy Bypass
2. Bypass “Running scripts is disabled” error for the current script:
If you want to bypass the default script execution policy only for the specific script, give the following command:
- Powershell -ExecutionPolicy Bypass -File script.ps1
3. Change the Execution Policy for All Users.
If you want to allow the execution of scripts for all users on the PC, open PowerShell or Terminal as Admin and give one of the following commands according what do you want to do:
A. To allow locally-created scripts to run (even unsigned), or scripts downloaded from the Internet but signed by a trusted publisher, issue one of these commands:
- Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
- Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
B. To allow all scripts to run, even the unsinged scripts downloaded from Internet, give the following command:*
- Set-ExecutionPolicy -ExecutionPolicy Unrestricted
* Important: The above command puts your computer at risk because it allows all scripts to run, even malicious ones.
4. Set Execution Policy for the current user.
A. If you want to allow locally generated scripts (even unsigned) or downloaded signed scripts to run only for the currently logged in user, issue this command in PowerShell (Admin):
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
B. If you want to allow all scripts to run (the unsinged scripts downloaded from Internet), only on the currently logged in user, give the following command:*
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
* Important: The above command puts your computer at risk because it allows all scripts to run, even malicious ones.
<.p>
Method 3. Allow Scripts to Run in Group Policy.
If you’re running Windows 10/11 Pro, you can change the Execution Policy in Group Policy as follows:
1. Press Windows + R keys to open the run command box.
2. Type gpedit.msc and press Enter to open the Group Policy Editor
3. In Policy Editor, go to the following path from the left:
Computer Configuration > Administrative Templates > Windows Components > Windows PowerShell
4a. At the right pane, double-click to open the Turn on Script Execution policy.
4b. Set the Policy to Enabled and then from the ‘Execution Policy’ drop-down menu, select Allow local scripts and remote signed scripts. Then click Apply & OK to save your setting.*
* Note: To disallow scripts to run set this policy back to Not Configured.
How to Check the Current Execution Policy.
1. Open PowerShell or Windows Terminal as Administrator:
2. To view the current execution policy on a Windows 10/11 machine, give this command:
- Get-ExecutionPolicy
3. To get all of the execution policies that affect the current session, issue this command:
- Get-ExecutionPolicy -List
How to Set the Default Execution Policy on Windows 10/11.
If after running your scripts, you want to reset back the execution policy back to its default setting, do the following:
1. Open PowerShell or Windows Terminal as Administrator & give the following command:
- Set-ExecutionPolicy Default
That’s all folks! Please leave a comment in the comment section below or even better: like and share this blog post in the social networks to help spread the word about this solution.
- Author
- Recent Posts
- FIX: Running scripts is disabled on this system on Windows 10/11 – February 15, 2024
- FIX: Device is Missing Important Security and Quality Fixes in Windows 11/10. – February 13, 2024
- FIX: Facebook Messenger forces to create a PIN to access chat history. (Solved) – February 7, 2024