đ Executive Summary
TL;DR: New Windows 11 laptops often block PowerShell script execution due to the default Restricted Execution Policy. This can be resolved temporarily with Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass or permanently for your user with Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned (as administrator), unless a Group Policy Object is enforced.
đŻ Key Takeaways
- PowerShellâs Execution Policy is a safety feature, not a security firewall, designed to prevent accidental script execution, with
Restrictedbeing the default on Windows 11 clients. - The
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypasscommand provides a temporary, session-specific fix for running scripts without requiring administrator privileges. - For a permanent user-specific solution,
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned(run as Administrator) is recommended, allowing local scripts to run while requiring signatures for internet-downloaded scripts. - When Group Policy Objects (GPOs) are in effect, local
Set-ExecutionPolicychanges will not persist, necessitating communication with IT to adjust policies or provide alternatives.
Hitting PowerShellâs âscript execution is disabledâ error on a new Windows 11 machine? Here are three real-world ways to fix the Execution Policy, from a Senior DevOps Engineer whoâs been there.
So, Your New Windows 11 Laptop Wonât Run Your PowerShell Script? Letâs Talk Execution Policy.
I remember it like it was yesterday. 2 AM, a production deployment for a major client goes sideways. The fix was simple: a PowerShell script Iâd written to re-sync a configuration database on a freshly provisioned VM, prod-config-db-04. I remoted in, pasted the script path, hit enter, and⌠saw a wall of red text. ...cannot be loaded because running scripts is disabled on this system. My heart sank. The simplest, most basic thing was blocking a critical fix. Weâve all been there, staring at a brand-new machine that refuses to run the very tools we need to do our jobs. Itâs frustrating, but letâs demystify it so it never slows you down again.
The âWhyâ: What is Execution Policy, Really?
Before we fix it, letâs understand the root cause. PowerShellâs Execution Policy isnât a security firewall. I need you to get that straight. Itâs a safety feature, like the plastic cover over a âlaunchâ button. Itâs designed to prevent you from accidentally running scripts you didnât intend to. On a fresh Windows client OS like Windows 11, the default policy is often Restricted, which means âdonât run any scripts, period.â
Here are the common levels youâll encounter:
| Policy | What It Means |
Restricted |
Default on Windows clients. No scripts can be run. You can only use PowerShell interactively. |
AllSigned |
You can run scripts, but they must be digitally signed by a trusted publisher. |
RemoteSigned |
You can run your own local scripts. Scripts downloaded from the internet must be signed by a trusted publisher. This is the sweet spot for most of us. |
Unrestricted |
All scripts can run, but youâll get a warning for scripts downloaded from the internet. |
Bypass |
Nothing is blocked and no warnings are displayed. All scripts will run. |
The Fixes: From a Quick Hack to the Corporate Solution
Okay, enough theory. Youâve got a script to run. Here are three ways to get it done, depending on your situation.
1. The Quick Fix: âI Just Need This to Work NOWâ
This is my 2 AM, production-is-down, get-it-done method. It applies a policy that only lasts for your current PowerShell session. As soon as you close the window, itâs gone. Itâs safe, temporary, and effective.
Open PowerShell and run this command:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
The key here is -Scope Process. It tells PowerShell, âJust for this window, right now, let me do what I need to do.â You donât even need to be an administrator to run it. This is the perfect tool for running a quick hardening or setup script on a new machine without making permanent changes.
2. The Permanent Fix: âThis is MY Machineâ
If youâre setting up your own developer laptop, youâre going to be running scripts all day long. You need a more permanent solution. For this, weâll set the policy just for your user account. The most balanced and secure option for this is RemoteSigned.
First, you must open PowerShell as an Administrator. Right-click the PowerShell icon and select âRun as administratorâ. Then, run this command:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
Now, any script you write on your machine will run without issue. If you download a script from the internet, PowerShell will still protect you by requiring it to be signed (or youâll have to explicitly unblock the file). This is the setting I use on all my personal workstations.
Pro Tip: If a downloaded script is being blocked, but you trust it, you can unblock it. In File Explorer, right-click the
.ps1file, go to Properties, and at the bottom of the General tab, youâll see a security message. Just check the âUnblockâ box and click OK.
3. The âNuclearâ Option: Dealing with Corporate Handcuffs
What if you try the permanent fix, and it either doesnât work or reverts itself after a reboot? Welcome to the enterprise, my friend. Your machine is likely being controlled by a Group Policy Object (GPO) set by your IT or Security team.
In this case, no command you run locally will stick. The GPO will always win. Your first step is to confirm this is the case. Open a regular command prompt (or PowerShell) and run:
gpresult /r
Look for a section called âApplied Group Policy Objectsâ. If you see something in there that sounds like âPowerShellSecurityâ or âWorkstationHardening,â youâve found your culprit. The âfixâ here isnât a command. The fix is to have a conversation with your IT department. Explain what youâre trying to do and why. They may be able to put you in a developer group with a more lenient policy or provide an alternative, like a code-signing certificate.
Fighting a GPO is a losing battle. Working with your team is the only way forward.
đ Read the original article on TechResolve.blog
â Support my work
If this article helped you, you can buy me a coffee:

Top comments (0)