Skip to content

Commit

Permalink
Snippets for working with event logs
Browse files Browse the repository at this point in the history
  • Loading branch information
SamErde committed Feb 1, 2024
1 parent 2ab5ac1 commit b0240df
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Resolve SID in Event Logs.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# When you have a security principal
((Get-WinEvent -FilterHashtable @{LogName = 'System'; ID=1501} -MaxEvents 1).UserId).Translate([System.Security.Principal.NTAccount]).Value

# When you have a SID as a string
[System.Security.Principal.SecurityIdentifier]::new($sid).Translate([System.Security.Principal.NTAccount]).value

0 comments on commit b0240df

Please sign in to comment.