Skip to content

Instantly share code, notes, and snippets.

@Beercow
Created May 13, 2019 15:39
Show Gist options
  • Save Beercow/8fc4c838f5fb0c0c6d5c8efdef722cd5 to your computer and use it in GitHub Desktop.
Save Beercow/8fc4c838f5fb0c0c6d5c8efdef722cd5 to your computer and use it in GitHub Desktop.
Get data types for event logs
$provider = get-winevent -ListProvider *
$Collection =@()
foreach ($entry in $provider)
{
foreach ($object in $entry.events)
{
foreach ($log in $entry.LogLinks.LogName)
{
[xml]$data = $object.Template
foreach ($DataType in $data.template.data.name)
{
$Props = @{
'LogName' = $log
'Provider' = $entry.Name
'ID' = $object.Id
'Data Type' = $DataType
}
$TotalObjects = New-Object PSCustomObject -Property $Props
$Collection += $TotalObjects
}
}
}
}
$Collection|Export-Csv -Path c:\temp\EventDataTypes.csv -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment