open book with paper planes coming from it

Q. Can PowerShell read and parse XML files?

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:

[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

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.