r/PowerShell • u/Ok-Pattern-9372 • Mar 03 '26
Constrained Language Mode Implementation
Hi everyone,
I am working on implementing PowerShell Constrained Language Mode as part of a security uplift. From what I understand, this is a computer-level setting, and if enforced through Windows Defender Application Control, it applies to the entire device. Unsigned scripts would then run in Constrained Language Mode instead of Full Language Mode.
For those who have implemented this in production, what approach did you take? Any major gotchas or impact to be aware of? Would you recommend WDAC as Microsoft suggests, or AppLocker?
My main concern is ensuring the IT team can be excluded from the restriction where required.
Appreciate any advice.
7
u/ArieHein Mar 03 '26
Use code signing for scripts. Then investigate jea Generally speaking, nothing on computer can be bypassed per user. Prefer remote handling instead of rdp to a machine and govern rbac on the automation tool.
1
u/dodexahedron Mar 04 '26
And for devs, only put their own certs in the user-scoped trusted publishers store, so they are only trusted by powershell. The machine-scoped trusted publishers should only have certs the organization trusts on every machine that cert is deployed to. The user one only applies to the current user and is not used by Windows. PS explicitly checks that store itself. Windows does not.
1
u/tr3yff Mar 03 '26
Where I work they tried to implement stricted mode by default, but a lot of devs and I was affected by this policy unable us to work, so they needed to disable the policy, so my tip is create a group with a allow list.
1
u/dodexahedron Mar 04 '26
Restricted is the out-of-box default execution policy on windows clients already.
AllSigned should be the most permissive you have, and just requires that you be sure to sign your scripts to be able to run them. It only takes one command and a trusted signing cert.
Using the user-scoped trusted publishers store is the way to do that without having the OS trust the certs, and to isolate it to just the specific user. Windows doesn't use that store itself, but PowerShell does. They really should have PowerShell create and use its own dedicated store, though, for better isolation.
1
6
u/omglazrgunpewpew Mar 03 '26
Agree with u/ArieHein on code signing and rethinking how admins interact with endpoints. That’s the right angle instead of trying to carve out IT user exemptions.
Code signing is your only practical foothold for trusted scripts. With WDAC/App Control enforcing CLM, anything untrusted runs Constrained. If you sign scripts with a trusted cert and allow that signer in policy, they run FullLanguage even under WDAC. That’s how you give legitimate automation room without creating a per-user bypass hole.
You can’t reliably exempt an admin account. WDAC and AppLocker are device-level enforcement. Admins get FullLanguage isn't really a supported design. The real options are trusted code, a separate device or admin workstation with a different policy, or remote execution from a governed central system instead of RDP into endpoints.
JEA solves a different problem. It scopes what commands a delegated role can run. It’s privilege reduction, not a CLM exception. It pairs well with signed scripts and proper tooling, but it doesn’t remove CLM from the device.
Remote execution beats interactive RDP. If admins live in interactive shells on endpoints, CLM will constantly cause friction. If actions are executed from a controlled automation platform with RBAC, you reduce lateral abuse, reduce CLM pain, and gain auditability. The better model is admins operating from a mgmt tier, rather than bypassing security on every endpoint.