Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace WMI query with interop #4723

Merged

Conversation

aleksandrlevochkin
Copy link
Contributor

@aleksandrlevochkin aleksandrlevochkin commented Mar 21, 2024

WI
AB#2142810

Description
When we turn on the AZP_AGENT_CLEANUP_PSMODULES_IN_POWERSHELL knob the WMI query times out for some machines.

I added a new knob that allows to use interop to find parent processes.

Testing

Tested scenarios (in PS Core on Windows, for other platforms there should be no need to cleanup psmodules):

  1. AZP_AGENT_CLEANUP_PSMODULES_IN_POWERSHELL: "true"
    AZP_AGENT_USE_INTEROP_TO_FIND_PARENT_PROCESS: "false"
    WMI query is used to determine if powershell is one of the parent processes.

  2. AZP_AGENT_CLEANUP_PSMODULES_IN_POWERSHELL: "true"
    AZP_AGENT_USE_INTEROP_TO_FIND_PARENT_PROCESS: "true"
    Native Windows function is used to determine if powershell is one of the parent processes.

@aleksandrlevochkin
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@aleksandrlevochkin aleksandrlevochkin marked this pull request as ready for review March 28, 2024 10:19
@aleksandrlevochkin aleksandrlevochkin requested review from a team as code owners March 28, 2024 10:19
Copy link

azure-boards bot commented Mar 28, 2024

✅ Successfully linked to Azure Boards work item(s):

Copy link
Contributor

@DenisRumyantsev DenisRumyantsev left a comment

Choose a reason for hiding this comment

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

I tested it. Changes work as expected. Looks good, thanks!

@aleksandrlevochkin aleksandrlevochkin merged commit db013b8 into master Apr 2, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants