Share via


Stop PowerShell.exe from Starting!

What!?

"Have you gone mad? ", I hear you cry!

Last month (and year), I posted about limiting the functionality of PowerShell - Security Focus: Set ConstrainedLanguage Mode on My Machine.

This month (and this year), I've found an oddity with this particular UNSUPPORTED technique...

 

Warning: Don't Try This At Home!

Whilst playing around with the  __PSLockdownPolicy setting, I discovered that using a negative value causes the default PowerShell hosts to crash.

 
[Environment]::SetEnvironmentVariable('__PSLockdownPolicy', '-1', 'Machine')

 

Let's try and start PS...

 

capture195

 

Duly reported to the PowerShell powers that be.