Skip to content

Commit

Permalink
fixee
Browse files Browse the repository at this point in the history
  • Loading branch information
directionless committed Apr 3, 2024
1 parent a73e22d commit 0f4d551
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ee/debug/checkups/init_logs_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func writeInitLogs(ctx context.Context, logZip *zip.Writer) error {
cmdStr := `Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName='launcher'} | ForEach-Object { $_.Message }`
cmdStr := `Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName='launcher'} | ConvertTo-Json`
cmd, err := allowedcmd.Powershell(ctx, cmdStr)
if err != nil {
return fmt.Errorf("creating powershell command: %w", err)
Expand Down
9 changes: 6 additions & 3 deletions ee/debug/checkups/services_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,14 @@ func gatherServiceManagerEvents(ctx context.Context, z *zip.Writer) error {
return fmt.Errorf("creating eventlog-Get-WinEvent.json: %w", err)
}

filterExpression := fmt.Sprintf(`@{LogName='System'; ProviderName='Service Control Manager'; Data=%s}`, kolideSvcName)

cmdArgs := []string{
"Get-WinEvent",
`-FilterHashtable @{LogName='System'; ProviderName='Service Control Manager'}`,
"-MaxEvents 100",
"-FilterHashtable", filterExpression,
"|",
"ForEach-Object { $_.Message }",
"ConvertTo-Json",
}

cmd, err := allowedcmd.Powershell(ctx, cmdArgs...)
Expand All @@ -268,7 +271,7 @@ func gatherServiceManagerEventLogs(ctx context.Context, z *zip.Writer) error {

cmdletArgs := []string{
"Get-EventLog",
"-Newest", "50",
"-Newest", "100",
"-LogName", "System",
"-Source", "\"Service Control Manager\"",
"-Message", fmt.Sprintf("*%s*", kolideSvcName),
Expand Down

0 comments on commit 0f4d551

Please sign in to comment.