Skip to content

Conversation

@chelnak
Copy link
Contributor

@chelnak chelnak commented Jun 23, 2022

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

@chelnak chelnak added the bug Something isn't working label Jun 23, 2022
@chelnak chelnak requested a review from a team as a code owner June 23, 2022 15:52
@chelnak chelnak self-assigned this Jun 23, 2022
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 commit 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.
Copy link
Member

@david22swan david22swan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Though my powershell is not perfect

@LukasAud LukasAud merged commit 6f1f0c2 into main Jun 24, 2022
@chelnak chelnak deleted the GH-188-fix_environment_reset branch September 15, 2022 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Protected Event Logging is breaking execution

4 participants