Skip to content

Commit 01e08e2

Browse files
Fix Get-WinEvent from System/User32 (#36)
* Fix Get-WinEvent from System/User32 * Update hooks/environment.agent Co-authored-by: Elliot Saba <staticfloat@gmail.com> --------- Co-authored-by: Elliot Saba <staticfloat@gmail.com>
1 parent d8de6be commit 01e08e2

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

hooks/environment.agent

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,16 @@ if [[ ! -f "${AGENT_PRIVATE_KEY_PATH}" ]]; then
7777
echo "see https://github.com/JuliaCI/sandboxed-buildkite-agent/issues/42"
7878
echo "Showing debug information..."
7979
powershell.exe -Command "& {
80-
\$providers = @('nssm', 'User32');
80+
\$providers = @(
81+
@{LogName='Application'; ProviderName='nssm'},
82+
@{LogName='System'; ProviderName='User32'}
83+
);
8184
foreach (\$provider in \$providers) {
82-
Write-Host \"\`n ProviderName: \$provider\`n\";
83-
Get-WinEvent -LogName Application -FilterXPath \"*[System[Provider[@Name='\$provider']]]\" -MaxEvents 50 |
85+
Write-Host \"\`n ProviderName: \$(\$provider.ProviderName)\`n\";
86+
Get-WinEvent -LogName \$(\$provider.LogName) -FilterXPath \"*[System[Provider[@Name='\$(\$provider.ProviderName)']]]\" -MaxEvents 50 |
8487
Sort-Object TimeCreated |
8588
Select-Object TimeCreated, Id, LevelDisplayName, Message |
86-
Format-Table -AutoSize
89+
Format-Table -Wrap
8790
}
8891
}"
8992
exit 1

0 commit comments

Comments
 (0)