Xml
Powershell

Powershell works well together with xml. So let's say you have an xml file that you need data out of e.g. All the servernames:

Select-Xml -Path C:\scripts\test.xml -XPath "//serverName" | Select-Object -ExpandProperty node

Another examples is:

$xml = [xml](get-content xmldatafile.xml)
$xml.report.table1.Detail_collection.detail | Where { $_.TYPENAMEX -like 'Failure Audit'} | Select COMPNAME

In this example the structure of the xml file looked like:
<?xml version="1.0" encoding="utf-8" ?> 
- <Report p1:schemaLocation="Some data http://servername/ReportServer?%2freportserver+Reporting%2fSecurity+%3aFormat=XML&rc%3aSchema=True" Name="Account lockouts" textbox1="Account lockouts" xmlns:p1="http://www.w3.org/2001/XMLSchema-instance" xmlns="Account_x0020_lockouts">
- <table3>
- <Detail_Collection>
  <Detail /> 
  </Detail_Collection>
  </table3>
- <table2>
- <Detail_Collection>
  <Detail textbox26="All" textbox63="All" textbox59="All" textbox47="All" textbox45="All" textbox41="number" textbox35="Security" textbox22="Failure Audit,Success Audit" textbox18="Include events with any of the message text keywords: name" textbox21="User specified date and time" textbox61="2012-01-01 00:00:00" textbox56="2012-02-06 00:00:00" /> 
  </Detail_Collection>
  </table2>
- <table1 textbox23="" textbox13="">
- <Detail_Collection>
  <Detail SERVER="SERVERNAME" textbox24="time24:00" ID="SomeID" LOGNAME="system" TYPENAMEX="Success Audit"
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License