How can I change the MachinePolicy to run PowerShell scripts on Windows 11 Pro?

0
6
Asked By CuriousCat912 On

I'm looking for help on changing the MachinePolicy in Windows 11 Pro so I can run PowerShell scripts. I've tried a few approaches, but nothing seems to work. I've run the command `Set-ExecutionPolicy -Scope MachinePolicy Unrestricted` in an admin PowerShell, but I understand now that you can't change MachinePolicy that way. I also used the Group Policy Editor to enable script execution by choosing "Allow all scripts". However, when I check the policy settings, it still shows MachinePolicy as ***Restricted***, which is confusing. Is there something I might be missing, or is it even possible to change the MachinePolicy?

5 Answers

Answered By TechieWizard88 On

It sounds like you're running into conflicting Group Policy settings. MachinePolicy and UserPolicy should be managed through Group Policies, so if yours isn’t set to Undefined, something must be overriding your changes. You might want to check for any other GPOs that could be enforcing this restriction. Also, make sure to reboot your system after applying changes; sometimes that’s necessary for the changes to take effect. If the settings just won't budge, try checking the registry too; there might be something set there that's causing the issue.

CuriousCat912 -

I’m not really sure where another GPO could be coming from since this is my first time setting up execution policies. I did reboot after making changes, but no luck. How can I check the registry for this?

Answered By NoobQuestionAsker On

Just to confirm, are you running PowerShell as an administrator? That’s essential for making any execution policy changes.

CuriousCat912 -

Yes, I checked multiple times, haha!

Answered By PolicyGuru2021 On

Have you tried generating an HTML report for Group Policy results? By running `gpresult /H gpr.htm`, you can open the report in a browser and get a clearer view of which policies are currently applied to your system. This might help you identify what's enforcing the MachinePolicy restriction.

CuriousCat912 -

I ran the report, and it seems like the only change I’ve made is allowing all scripts, but it still feels like something is blocking it. What should I look for specifically in that report?

Answered By SecuritySavant On

Quick tip: Sometimes the scripts you’re trying to run might be blocked by default, especially if you downloaded them. Check the properties of the script file and see if there's an "unblock" option. That might be what's holding you back.

CuriousCat912 -

Actually, I already fixed that issue, but thanks for mentioning it!

Answered By PowerShellNinja65 On

Have you considered using the command `Set-ExecutionPolicy Bypass -Scope process`? This lets you run scripts in the current session without changing the policy permanently. Though, I understand you're looking for a more permanent fix.

CuriousCat912 -

I think I tried that before, but I prefer a lasting solution. Is it really just for temporary use?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.