File cannot be loaded because running scripts is disabled
File cannot be loaded because running scripts is disabled
DodaTech
3 min read
The “File cannot be loaded because running scripts is disabled on this system” error means PowerShell’s execution policy is blocking your script from running.
What It Means
PowerShell’s execution policy is a safety feature that controls the conditions under which scripts can run. The default policy on Windows client systems is Restricted — scripts are not allowed to run at all, only individual commands. This prevents accidental execution of untrusted scripts but also blocks legitimate ones. The error message tells you the script path and the current policy in effect.
Why It Happens
- The execution policy is set to
Restricted(default on most Windows client systems). - The policy is
AllSignedbut your script is not digitally signed. - The script was downloaded from the internet and has the Mark-of-the-Web.
- You are running in a constrained endpoint or AppLocker environment.
- Group Policy overrides the local execution policy setting.
- You are using PowerShell on a system managed by an organization with strict policies.
How to Fix It
1. Check your current execution policy
Get-ExecutionPolicy
# Possible values: Restricted, AllSigned, RemoteSigned, Unrestricted, Bypass2. Set the execution policy to RemoteSigned (recommended)
# Run as Administrator
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
# Or system-wide
Set-ExecutionPolicy RemoteSigned3. Bypass policy for a single script
# From Command Prompt or Run dialog
powershell.exe -ExecutionPolicy Bypass -File "C:\Scripts\myscript.ps1"
# From PowerShell itself
powershell.exe -ExecutionPolicy Bypass -File .\myscript.ps14. Unblock a downloaded script
# Remove the Mark-of-the-Web
Unblock-File -Path .\myscript.ps1
# Then run normally
.\myscript.ps15. Sign your script with a code-signing certificate
# For AllSigned policy, scripts must be signed
$cert = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert
Set-AuthenticodeSignature -FilePath .\myscript.ps1 -Certificate $cert6. Check for Group Policy overrides
# Machine-wide policy (may override local setting)
Get-ExecutionPolicy -Scope MachinePolicy
# User policy
Get-ExecutionPolicy -Scope UserPolicyBuilt by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro