Parsing an XML file with PowerShell

Question:

One of my application is generating below XML file.

I am interested in reading the value and errorcodes of “PWR.WakeupOnLAN” property name. Before posting here, I tried various things but couldn’t find correct code for reading properties in powershell. Can any one help me with powershell code for this?

Answer:

In PowerShell 2.0 you can solve this using the new Select-Xml cmdlet and an XPath expression:

Related resources:

Source:

Parsing an XML file with PowerShell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply