on-internet
← Community

Get-winEvent to XML, now how to get the values out

Stack Overflow ·

I'm relatively new to powershell, far more comfortable with SQL. I need to get some data out of the event logs. I've managed to establish so far that I need to use Get-WinEvent and use the xml element to get the actual info I want. So far I've got: $filterxml = " *[System[(EventID='4624')]] and ( *[EventData[Data[@Name='LogonType'] and (Data='10')]] or *[EventData[Data[@Name='LogonType'] and (Data='2')]] ) " $Events = Get-WinEvent -maxEvents 1 -Filterxml $filterXml # Get out the event message data ForEach ($Event in $Events) { # Convert the event to XML $eventXML = [xml]$Event.ToXml() #Now wha

Comments

Sign in or sign up to comment and upvote.

No comments yet.