Skip to content

Instantly share code, notes, and snippets.

@AlexAsplund
Last active April 28, 2023 03:51
Show Gist options
  • Save AlexAsplund/bf5eeed019cffb5ffe9970e902c83d66 to your computer and use it in GitHub Desktop.
Save AlexAsplund/bf5eeed019cffb5ffe9970e902c83d66 to your computer and use it in GitHub Desktop.
$Publishers = wevtutil ep
# Mååånga fel, antagligen pga. att inte eventet är dokumenterat OK hos provider
$ErrorActionPreference = "SilentlyContinue" # Shh sh sh
$AllEventData = Foreach($Publisher in $Publishers){
[XML]$Events = wevtutil gp $Publisher /ge /gm:true /f:xml
$Events.provider.events.event | Foreach {
[PSCustomObject]@{
event_id = $_.value
publisher = $Publisher
channel = $_.channel
task = $_.task
level = $_.level
message = $_.message
short_message = $_.message -replace "(^[^.]+).*",'$1'
}
}
}
$AllEventdata | ConvertTo-CSV -NoTypeInformation | Out-File C:\temp\event_descriptions.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment