Enable PowerShell Constrained Language Mode

Enable PowerShell Constrained Language Mode

This script will set an environment variable on the system to enable PowerShell Constrained Language Mode. It will alter your servers ability to operate PowerShell and should be tested before implementing into your production environment.

Script Description

This script will set an environment variable on the system to enable PowerShell Constrained Language Mode.

This can also be achieved using Microsoft GPP to implement and Environment Variable.

Script Deployment

Open up PowerShell as an Administrator on the system you wish to lock and run the below commands. Be sure to restart all PowerShell sessions after you have run the script.

Script Contents

[Environment]::SetEnvironmentVariable('__PSLockdownPolicy', 4, 'Machine')

© 2023. All rights reserved.

Powered by Hydejack v9.1.6