Q. Can PowerShell read and parse XML files?

A. Yes, although the means isn't very obvious. If you have an XML file named Mine.xml, do this:

  1. [xml]$xml = Get-Content Mine.xml

That'll read the file, parse the XML, and construct within the $xml variable an object tree based on the XML structure. Run

                              $xml | Get-Member

to see the root of the object hierarchy. For more information, see the introductory tutorial "PowerShell and XML".

Do you have a Windows PowerShell question? Find more PowerShell FAQs, articles, and other resources at windowsitpro.com/go/DonJonesPowerShell.