packer-plugin-hyperv icon indicating copy to clipboard operation
packer-plugin-hyperv copied to clipboard

Support running in PowerShell constrained language mode

Open camjjack opened this issue 4 years ago • 0 comments

Community Note

Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request. If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Description

Powershell constrained language mode. restricts access to sensitive language elements that can be used to invoke arbitrary Windows APIs. This plugin uses some elements that are blocked by constrained language mode.

Specifically this is often when we do something like invoking a .NET class rather than using inbuild powershell i.e., [IO.Path]::Combine(...

instead of Join-Path ...

The other main issue is building XML documents .createElement et. al.

Constrained language mode can be set by setting the registry key Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\_PSLockDownPolicy to 4. Setting it back to 8 will return to FullLanguage mode.

Use Case(s)

Ability to use packer when administrators have enabled Powershell constrained language mode

Potential configuration

Potential References

https://devblogs.microsoft.com/powershell/powershell-constrained-language-mode/

camjjack avatar Jan 31 '22 22:01 camjjack