Running an exported form in ConstrainedLanguage mode causes massive errors
Posted: Thu Jul 11, 2019 4:52 am
Product, version and build: PowerShell Studio 2019, 5.6.165
32 or 64 bit version of product: 64bit
Operating system: Windows 10 Enterprise (1809)
32 or 64 bit OS: 64bit
I have tried to run an exported form at a location in our network where ONLY the "ConstrainedLanguage" mode is allowed and it throws massive numbers of errors before finally running aground, which is totally understandable, due to the fact that Reflection is NOT allowed in the "ConstrainedLanguage" mode.
Now that you guys have gotten to know the "ConstrainedLanguage" mode I have a small request.
Please add the following code, or something else to this effect, to the top of each generated *.Export.ps1" file right after the param() section, if one exists, so that these scripts CAN error out gracefully and the user will have some sense as to why it will NOT work.
If you implement this, or something similar, I am sure you will prevent the creation of unnecessary problem tickets.
32 or 64 bit version of product: 64bit
Operating system: Windows 10 Enterprise (1809)
32 or 64 bit OS: 64bit
I have tried to run an exported form at a location in our network where ONLY the "ConstrainedLanguage" mode is allowed and it throws massive numbers of errors before finally running aground, which is totally understandable, due to the fact that Reflection is NOT allowed in the "ConstrainedLanguage" mode.
Now that you guys have gotten to know the "ConstrainedLanguage" mode I have a small request.
Please add the following code, or something else to this effect, to the top of each generated *.Export.ps1" file right after the param() section, if one exists, so that these scripts CAN error out gracefully and the user will have some sense as to why it will NOT work.
Code: Select all
$languageMode = $ExecutionContext.SessionState.LanguageMode.ToString().ToUpper()
If ($languageMode.Equals("CONSTRAINEDLANGUAGE")) {
Write-Error -Message "`nRunning in the `"ConstrainedLanguage`" mode!`nPowerShell Forms will NOT work in this mode!`n`nContact your system administrator!"
Exit
}