Created
May 13, 2019 15:39
-
-
Save Beercow/8fc4c838f5fb0c0c6d5c8efdef722cd5 to your computer and use it in GitHub Desktop.
Get data types for event logs
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
$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