Hello, I need to query an XML based file to extract info. I have used the line below in a script with success,
$Xml.category.machine | Select-Object -Property IP | format-table
based on querying an XML file formatted as below
<Category name="System Summary">
<!--1. machine details-->
<Machine test="22">
<Name>Server1</Name>
<IP>31.248.95.170</IP>
However the data I need to query is in the format of below. Can anyone help with how I can reference this to get output from below of Display_Name, State and Start_Mode (the 'Category' field is not unique in the 2nd file so ideally I would be able to search for Category name="System Summary" but this doesn't work for me. Thanks!
<Category name="Services">
<Data>
<Display_Name><![CDATA[Adobe Flash Player Update Service]]></Display_Name>
<Name><![CDATA[AdobeFlashPlayerUpdateSvc]]></Name>
<State><![CDATA[Stopped]]></State>
<Start_Mode><![CDATA[Manual]]></Start_Mode>
<Service_Type><![CDATA[Own Process]]></Service_Type>
<Path><![CDATA[c:\windows\system32\macromed\flash\flashplayerupdateservice.exe]]></Path>
<Error_Control><![CDATA[Normal]]></Error_Control>
<Start_Name><![CDATA[LocalSystem]]></Start_Name>
<Tag_ID><![CDATA[0]]></Tag_ID>
</Data>
<Data>