How to Change PowerShell Execution Policy (Without Breaking Everything)

How to Change PowerShell Execution Policy (Without Breaking Everything)

Photo by Andrew on Unsplash

So there I was, trying to run a perfectly legitimate deployment script at like 11pm, and PowerShell just stares back at me with that wonderful error: "cannot be loaded because running scripts is disabled on this system." Classic. If you've ever needed to change the PowerShell execution policy and found yourself clicking through five different Stack Overflow tabs, this one's for you.

Here's the thing though — execution policy trips people up not because it's complicated, but because there are actually several ways to set it, and they don't all behave the same way. Scope matters a lot here, and most quick-fix guides gloss right over that part.

What Even Is Execution Policy?

PowerShell's execution policy is basically a safety guardrail that controls which scripts are allowed to run on your system. It's not a security boundary in the hardcore sense — Microsoft's own docs will tell you that — but it does stop you (and your users) from accidentally running something sketchy. Think of it as a "are you sure about this?" mechanism that's baked into Windows.

There are a handful of policy levels you'll actually encounter in the wild:

Restricted — Default on Windows clients. No scripts run. Period. You can still run individual commands interactively, but .ps1 files? Nope.

RemoteSigned — Honestly, this is the sweet spot for most people. Scripts you write locally run fine. Scripts downloaded from the internet need a digital signature. It's a reasonable balance.

AllSigned — Every script, even ones you wrote yourself, needs to be signed. More secure, but way more annoying in day-to-day admin work. I've seen this bite sysadmins who forgot to re-sign a script after a minor edit.

Unrestricted — Everything runs. You'll get a warning prompt for internet-downloaded scripts, but they'll still execute. Use this carefully.

Bypass — Nothing is blocked, nothing is warned. This one's mostly for automation pipelines where you've already handled trust elsewhere.

The Basic Command to Change It

Open PowerShell as Administrator (right-click → Run as Administrator — yes, you need elevation for most of these) and run:

Set-ExecutionPolicy RemoteSigned

PowerShell will ask you to confirm. Hit Y and you're done. Simple enough, right? But here's where most guides stop and where real-world stuff starts to get interesting.

Scope Is Where It Gets Tricky

The -Scope parameter is the part that actually matters in enterprise environments, and I can't tell you how many times I've seen it ignored. PowerShell checks execution policy across multiple scopes, and they stack in priority order.

The scopes, from highest to lowest priority:

MachinePolicy and UserPolicy — Set by Group Policy. If your org pushes these via GPO, your manual changes will be completely ignored. I've seen people spend an hour troubleshooting this before realizing GPO was just overwriting everything.

Process — Only applies to the current PowerShell session. Gone when you close the window. Super useful for one-off scripts.

CurrentUser — Applies just to you, stored in your user registry hive.

LocalMachine — Applies to everyone on the machine. This is what you're setting when you use Set-ExecutionPolicy without specifying a scope.

So if you want to temporarily allow scripts just for your current session without touching system-wide settings, do this:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

That's actually my go-to when I'm testing something quickly on a locked-down machine. It doesn't persist, it doesn't require as much justification in a change ticket, and it doesn't leave the system more permissive than it needs to be afterward.

Check What's Currently Set

Before you change anything, it's worth knowing what you're working with:

Get-ExecutionPolicy -List

This shows you every scope and what's set at each level. Way more useful than just running Get-ExecutionPolicy by itself, which only shows you the effective policy. When something's being overridden by GPO, this is how you figure that out.

The Insider Trick Most People Don't Know

Alright, here's one that's saved me more than once — if you need to run a single script on a restricted machine and you really can't (or don't want to) change the execution policy, you can pipe the script content directly to PowerShell and bypass the restriction entirely:

powershell -ExecutionPolicy Bypass -File "C:\scripts\myScript.ps1"

Or if you want to get a little creative, you can read and invoke the script content like this:

Get-Content "C:\scripts\myScript.ps1" | Invoke-Expression

Fair warning — Invoke-Expression has a bit of a reputation and a lot of security folk will raise an eyebrow at it. Use it in controlled situations, not as a general habit. But in a pinch, it works.

The other trick worth knowing: if you're deploying a policy change across a fleet of machines via a remote management tool or a logon script, you can skip the confirmation prompt with the -Force flag:

Set-ExecutionPolicy RemoteSigned -Force

Without -Force, the confirmation dialog will stall your automation. Found that out the hard way during a rollout once. Fun times.

A Note on Group Policy

If you're in a domain environment and your execution policy keeps reverting — Group Policy is probably the culprit. Check with your AD admin or look under Computer Configuration → Administrative Templates → Windows Components → Windows PowerShell in the Group Policy Management Console. There's a setting called "Turn on Script Execution" that will override whatever you set locally.

Honestly, if you're managing a team's machines, setting execution policy through GPO is the right way to do it anyway. Keeps things consistent and documented.

Quick Reality Check

Don't set everything to Unrestricted or Bypass just to make scripts run. I've seen this on machines where someone just wanted to stop fighting with the error — totally understandable frustration — but then those machines sit like that for years. RemoteSigned covers 95% of legitimate use cases without leaving the door wide open.

And always check your current policy list before and after making changes. Thirty seconds of verification saves a lot of head-scratching later.

Hope this saves you some time the next time PowerShell decides to play gatekeeper at the worst possible moment.

Related: PowerShell Execution Policy Explained (And How to Actually Fix It)

๋Œ“๊ธ€

Zoho IMAP Settings: The Complete Fix When Your Email Stops Syncing

Quick Summary Zoho IMAP breaks more often than it should, and the error messages are genuinely useless. The fix is usually a combination of using the right server address, enabling IMAP inside Zoho Mail's settings, and generating an app-specific password. This guide covers the exact steps for Outlook, iPhone, Thunderbird, and Android so you stop going in circles. Photo by Fotis Fotopoulos on Unsplash So your Zoho Mail stopped syncing. Emails aren't coming in, your phone shows a spinning indicator forever, or Outlook throws some vague authentication error and you have no idea what changed. Sound familiar? I've seen this exact situation probably thirty times across different clients, and every single time the person swears they didn't change anything. And honestly? They usually didn't. Zoho changed something on their end, or an app update reset a setting, or someone enabled two-factor authentication without realizing what that does to third-party mail clients. The...

Zoho Mail IMAP Configuration: Exact Settings That Work First Time

Quick Summary Getting Zoho Mail IMAP to work in Outlook or Thunderbird is not as straightforward as Zoho's docs make it sound. The port numbers, SSL settings, and app password requirements catch almost everyone off guard the first time. Here are the exact settings and steps that actually work, without the back-and-forth with support. Photo by Fotis Fotopoulos on Unsplash Last month I spent almost two hours on a Friday afternoon helping a new employee get Zoho Mail working in Outlook. Two hours. The settings look simple on paper — and honestly, they are — but there are two or three specific things that Zoho just does not make obvious, and if you miss any one of them, you get a generic authentication error that tells you absolutely nothing useful. Sound familiar? The thing is, I've set up Zoho IMAP maybe forty times across different clients and different mail apps. Outlook, Thunderbird, Apple Mail, even some third-party Android clients. And every single time, someone new come...

์ด ๋ธ”๋กœ๊ทธ ๊ฒ€์ƒ‰

Magnesium Glycinate vs Magnesium Citrate: Which One Actually Fixed My Sleep

Quick Summary I spent months trying different magnesium forms after my sleep fell apart, and the difference between glycinate and citrate is way bigger than I expected Glycinate is the gentler, slower option great for sleep and anxiety, while citrate works faster but comes with some digestive surprises nobody warns you about If you're confused about which one to take, this breaks down exactly what each form does and who should actually be using it Photo by Anshu A on Unsplash About two years ago I hit a wall. I was waking up at 3am every single night, my legs felt restless, and I was grinding my teeth so bad my jaw hurt in the morning. My doctor ran some basic labs, everything came back "normal," and I left that appointment feeling completely dismissed. A friend of mine — she's really into functional nutrition — casually mentioned that I might just be magnesium deficient. I kind of rolled my eyes at first. It sounded like one of those wellness buzzwords people throw...
↑