Reading XML using PowerShell

Stumbled across a very simple way to read an XML document using Powershell. This is so simple and concise. You just get the content and convert it to an XML object.


 [xml]$books = Get-Content C:\Books.XML 


 $books.catalog.book.title 

Thanks to The Scripting Guy.

http://blogs.technet.com/b/heyscriptingguy/archive/2012/09/13/powertip-use-powershell-to-easily-read-an-xml-document.aspx

Advertisements
Tagged with: ,
Posted in Development

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: