Ever tried running a PowerShell scripts and got slapped with this message:
“Execution of scripts is disabled on this system.”
— don’t worry. You’re not alone and we’ll get up and running in no time.
❓ What Does This Error Mean?
By default, PowerShell locks down script execution to protect your system. This means you can run commands in the console, but you can’t execute .ps1 scripts unless you adjust the execution policy.
This is especially common when:
- You’re on a new machine
- You’re using PowerShell ISE or VSCode
- You’ve just installed something like dbatools or automation scripts
- You’re running a script downloaded from the internet or GitHub
✅ The Quick Fix
To allow PowerShell to execute scripts, run the following command as Administrator (right click ISE):
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
🔍 What This Does:
RemoteSigned: Enables local scripts to run freely. Scripts downloaded from the internet must be digitally signed.-Scope LocalMachine: Applies this policy to all users on the machine.
🛡️ Other Execution Policy Options
| Policy | Description |
|---|---|
| Restricted | No scripts can run. Default on many systems. |
| AllSigned | Only scripts signed by a trusted publisher can run. |
| RemoteSigned | Local scripts run freely; internet scripts must be signed. (Recommended) |
| Unrestricted | All scripts run, no questions asked. Not recommended for production use. |
📌 Final Thoughts
This is classic roadblock that impacts all devs alike so is useful to know the fix for the long run. Luckily, it’s a one-time fix that opens the door to automation.
Just remember to always review any scripts you download before running them — especially from the internet. Not everything that ends in .ps1 is your friend.
