Skip to content

Commit e091ad7

Browse files
committed
Add helper allow running the collector manually on Windows
1 parent fe6a0ce commit e091ad7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

internal/buildscripts/packaging/msi/splunk-support-bundle.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ for ( $i = 0; $i -lt $args.count; $i++ ) {
5757
}
5858
}
5959

60+
#######################################
61+
# Extracts the environment variables configured for the splunk-otel-collector service
62+
# and sets them in the current PowerShell session. This is useful to directly run the
63+
# collector from the PowerShell console. This is not required for the support bundle.
64+
# - GLOBALS: None
65+
# - ARGUMENTS: None
66+
# - OUTPUTS: None
67+
# - RETURN: None
68+
#######################################
69+
function setCurrentEnvironmentForManualRun() {
70+
$env_array = Get-ItemPropertyValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\splunk-otel-collector" -Name "Environment"
71+
foreach ($entry in $env_array) {
72+
$key, $value = $entry.Split("=", 2)
73+
[Environment]::SetEnvironmentVariable($key, $value)
74+
}
75+
}
76+
6077
#######################################
6178
# Creates a unique temporary directory to store the contents of the support
6279
# bundle. Do not attempt to cleanup to prevent any accidental deletions.

0 commit comments

Comments
 (0)