Powershell: Convert XML to String

uprix picture uprix · Mar 14, 2013 · Viewed 40.9k times · Source

I am searching for a way to convert a XML-Object to string.

Is there a way like $xml.toString() in Powershell?

Answer

Stanley De Boer picture Stanley De Boer · Mar 14, 2013

You are probably looking for OuterXml.

$xml.OuterXml should give you what you want.