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.
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