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

Make Windows TA agnostic to Powershell ExecutionPolicy #5935

Conversation

pjanotti
Copy link
Contributor

Description:
If the account launching the TA can't run powershell scripts the end result is the collector process running but no script monitoring the termination of the collector parent and terminating the collector. This change fixes that by launching the Powershell executable with the proper option to avoid that.

Collateral: added date and time to Powershell script logs.

Testing:
Validated script under splunkd and manually.

Documentation: N/A

cc @hughesjj

@pjanotti pjanotti requested review from a team as code owners February 25, 2025 03:59
Copy link
Contributor

@hughesjj hughesjj left a comment

Choose a reason for hiding this comment

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

Never seen $true before, interesting

@@ -206,7 +208,7 @@ echo on
set "log_type=%~1"
set "log_msg=%~2"

for /f "delims=" %%a in ('powershell -noninteractive -noprofile -command "get-date -format 'MM-dd-yyyy HH:mm K'"') do (
for /f "delims=" %%a in ('powershell -noninteractive -noprofile -command "get-date -format 'yyyy-MM-dd HH:mm:ss.fff K'"') do (
Copy link
Contributor

Choose a reason for hiding this comment

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

<3

@hughesjj hughesjj merged commit 4481d72 into signalfx:main Feb 25, 2025
7 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants