Either with AppLocker \ WDAC or
Check
$ExecutionContext.SessionState.LanguageMode
- Create/Edit a GPO: In Group Policy Management, create a new GPO (e.g., “Set CLM to 4”).
- Navigate to Preferences: Go to
Computer Configuration>Preferences>Windows Settings>Environment. - Add Variable: Right-click, select New > Environment Variable.
- Action:
Update - Name:
__PSLockdownPolicy - Value:
4 - Type:
System Variable
- Action:
Windows Security – Locking Down Powershell Script Execution (from ThioJoe Video) · GitHub
