By default, Windows PowerShell operates under a strict security constraint known as the “Execution Policy.” If you write a custom PowerShell script (a .ps1 file) to automate a repetitive task and attempt to run it, PowerShell will violently block the execution and throw a massive wall of red error text stating: “cannot be loaded because running scripts is disabled on this system.”
Microsoft intentionally implemented this “Restricted” policy to prevent novice users from accidentally downloading and double-clicking malicious scripts from the internet. However, if you are a system administrator, a developer, or a power user who frequently writes and executes local automation scripts, this constant blocking is an infuriating roadblock. To reclaim control over your own terminal and force PowerShell to execute any script you provide without complaining, you must completely disable the Execution Policy restrictions.
Disabling the Execution Policy via an Administrative Terminal
You can instantly downgrade the security posture of the terminal using a single, powerful cmdlet, but you must run it with elevated privileges.
- Click the Start button on your Windows taskbar.
- Type
PowerShellinto the search bar. - Look at the search results. Right-click on the “Windows PowerShell” app icon and select Run as administrator. (Click “Yes” on the UAC prompt).
- A blue terminal window will open with “Administrator” in the title bar.
- Paste the following command exactly as written and press Enter:
Set-ExecutionPolicy Unrestricted - PowerShell will pause and display a severe warning message in yellow text, asking you to confirm that you understand the security risks of changing the execution policy.
- Type the letter Y (for Yes) and press Enter.
Verifying the Change
The policy applies immediately across the entire operating system, and it will persist through reboots.
- To guarantee the command was successful, type the following and press Enter:
Get-ExecutionPolicy - The terminal should return a single word:
Unrestricted.
Extreme Warning: Your Windows installation will now execute any PowerShell script you throw at it, regardless of where it came from or whether it is digitally signed. If you download a malicious .ps1 file from a phishing email and accidentally run it, it will execute silently with full access to your user permissions. You should only use this setting if you exclusively run scripts that you have written yourself or thoroughly vetted.