You download or write a PowerShell script, run it, and get this red error:
File C:\Scripts\script.ps1 cannot be loaded because running scripts is disabled on this system.
For more information, see about_Execution_Policies.
Nothing is broken. Windows is doing what it's designed to do: by default, Windows client PCs don't run PowerShell scripts at all. As an IT engineer who writes PowerShell every day, here's how I fix it safely, without weakening security more than needed.
Quick fix (most users)
Open PowerShell (no admin needed) and run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Type Y to confirm. Now scripts you create on your PC run, while scripts downloaded from the internet must be signed or unblocked first. This is the setting Microsoft uses by default on Windows Server, and the one I recommend for most people.
Why this error happens: execution policies
PowerShell's execution policy decides which scripts can run. The main options are:
- Restricted: no scripts run, only individual commands. Default on Windows 10 and 11.
- RemoteSigned: local scripts run; downloaded scripts need a trusted signature. Default on Windows Server.
- AllSigned: every script must be signed by a trusted publisher.
- Bypass: nothing is blocked and no warnings appear. Meant for automation.
- Unrestricted: everything runs, with a warning for downloaded scripts.
Microsoft is clear that the execution policy is a safety feature, not a security boundary. It stops you from running scripts by accident; it doesn't stop a determined attacker. That's why there's no need to set it to Unrestricted for everyone.
Step 1: Check your current policy
Get-ExecutionPolicy -List
You'll see five scopes, from highest to lowest priority: MachinePolicy, UserPolicy, Process, CurrentUser and LocalMachine. The first one that isn't "Undefined" wins.
Step 2: Choose the right fix
Option A: Allow scripts for your account (recommended)
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Affects only your user account and doesn't need administrator rights.
Option B: Allow scripts for all users (admin)
Run PowerShell as administrator:
Set-ExecutionPolicy RemoteSigned -Scope LocalMachine
Option C: Run one script without changing anything
Perfect when you only need a script once:
powershell.exe -ExecutionPolicy Bypass -File "C:\Scripts\script.ps1"
Or allow scripts only in the current window (it resets when you close it):
Set-ExecutionPolicy Bypass -Scope Process
Option D: Use Windows Settings (Windows 11)
Windows 11 has a switch for developers. Go to Settings > System > For developers (named Advanced on newer builds), find the PowerShell section and turn on the option to run local scripts without signing. It sets the same RemoteSigned policy for you.
Still blocked? Unblock downloaded scripts
With RemoteSigned, scripts downloaded from the internet or email carry a hidden "from the internet" mark and are still blocked. If you trust the script and have read it, unblock it:
Unblock-File -Path "C:\Scripts\script.ps1"
Or right-click the file, choose Properties, tick Unblock and click OK. To unblock a whole folder:
Get-ChildItem "C:\Scripts" -Recurse | Unblock-File
"The setting is overridden by a policy defined at a more specific scope"
If Get-ExecutionPolicy -List shows a value under MachinePolicy or UserPolicy, your organization sets it through Group Policy or Intune. You can't change it locally, and you shouldn't try to work around it on a work PC. Ask your IT team, who can sign the script or add an exception.
Admins can set it centrally in Group Policy under Computer Configuration > Administrative Templates > Windows Components > Windows PowerShell > Turn on Script Execution.
What about PowerShell 7?
PowerShell 7 (pwsh) on Windows uses its own execution policy settings, separate from Windows PowerShell 5.1, so you may need to run the same command in both. On Linux and macOS, execution policies aren't enforced.
Security tips
- Don't use Unrestricted or Bypass at the LocalMachine scope just to make an error go away.
- Read any script before you run it, especially one copied from a forum, chat or AI tool.
- Never run a PowerShell command that a "support agent" asks you to paste; this is a common scam that installs remote-access tools. If it happens, follow our guide on what to do after you've been hacked.
- In companies, sign internal scripts and use AllSigned where possible.
FAQ
Is it safe to set the execution policy to RemoteSigned?
Yes, for most users. It's Microsoft's default for Windows Server, and downloaded scripts still need a signature or a deliberate unblock.
How do I undo the change?
Run Set-ExecutionPolicy Undefined -Scope CurrentUser to go back to the default.
Do I need administrator rights?
Not for the CurrentUser or Process scopes. You need administrator rights only for LocalMachine.
More Windows fixes: Windows key not working and Windows Update stuck or failing.
Reference: Microsoft Learn, "about_Execution_Policies".

0 Comments