title: Get-winEvent to XML, now how to get the values out
body: <p>I'm relatively new to powershell, far more comfortable with SQL.</p>
  
  <p>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.</p>
  
  <p>So far I've got:</p>
  
  <pre><code>$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 what?? I need to find out how to return the actual data in a form I 
  #can put into a datatable.
  
  }
  </code></pre>
  
  <p>It seems like it should be so easy to chuck out the values to either into variables or straight into a datatable etc.</p>
  
  <p>I've been looking for a solution for a while without any luck.</p>