hashicorp / hashicorp/packer-plugin-hyperv

Support running in PowerShell constrained language mode

Open
#55 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
27
Forks
28
PR merge metrics
No merged PRs in 30d

Description

#### Community Note

Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) 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.](https://devblogs.microsoft.com/powershell/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/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.