Skip to content

Support running in PowerShell constrained language mode #55

@camjjack

Description

@camjjack

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/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions