Turning Off “FullLanguage” Mode

by Oct 24, 2014

All PowerShell versions

PowerShell can be restricted in many ways. One is to set the language mode from “FullLanguage” to “RestrictedLanguage”. It is a way of no return, at least unless you close and re-open PowerShell:

 
$host.Runspace.SessionStateProxy.LanguageMode = 'RestrictedLanguage'
 

Once set to “RestrictedLanguage”, PowerShell will only execute commands. It will no longer execute object methods or access object properties, and you can no longer define new functions.

So RestrictedLanguage basically is a safe lockdown where PowerShell can execute commands but cannot dive into low level .NET or override existing commands with newly created functions.

Twitter This Tip! ReTweet this Tip!