Created
June 22, 2017 00:50
-
-
Save dstreefkerk/5de1e9cd991d6b5b62ee96f64c4fd60b to your computer and use it in GitHub Desktop.
Pull AppLocker logs out of the Forwarded Logs folder on a Windows Event Collector, and present them in a GridView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-AppLockerLogs { | |
$filter = ' | |
<QueryList> | |
<Query Id="0" Path="ForwardedEvents"> | |
<Select Path="ForwardedEvents">*[System[Provider[@Name="Microsoft-Windows-AppLocker"] and (Level=2 or Level=3)]]</Select> | |
</Query> | |
</QueryList> | |
' | |
$data = Get-WinEvent -FilterXml $filter -Oldest | |
foreach ($log in $data) { | |
[xml]$tempXML = $log.ToXml() | |
$objSID = $null | |
$objUser = $null | |
$objSID = New-Object System.Security.Principal.SecurityIdentifier($log.UserId.Value) | |
try { | |
$objUser = $objSID.Translate([System.Security.Principal.NTAccount]) | |
} | |
catch { | |
$objUser = $log.UserId.Value | |
} | |
$tempObject = [ordered]@{ | |
LogName = $log.LogName | |
TimeCreated = $log.TimeCreated | |
FilePath = $tempXML.Event.UserData.RuleAndFileData.FilePath | |
ComputerName = $log.MachineName | |
UserID = $objUser.Value | |
Signer = $tempXML.Event.UserData.RuleAndFileData.Fqbn | |
Message = $tempXML.Event.RenderingInfo.Message | |
} | |
New-Object PSObject -Property $tempObject | |
} | |
} | |
Get-AppLockerLogs | Out-GridView -Wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment