puppetlabs / ruby-pwsh

A ruby gem for interacting with PowerShell
MIT License
15 stars 23 forks source link

(GH-188) Filter current environment variables #189

Closed chelnak closed 2 years ago

chelnak commented 2 years ago

When Protected Event Logging and PowerShell Script Block logging are enabled together the SystemRoot environment variable is a requirement.

If it is removed as part of the environment purge it causes the PowerShell process to crash, therefore breaking the pipe between Ruby and the remote PowerShell session.

This PR fixes the issue by creating a filtered list of environment variables which does not include the SystemRoot environment variable.

This list can then be purged safely.

Closes #188