Formatting XML from PowerShell

Question:

I have a PowerShell script that runs a stored procedure which returns XML. I then export the XML into a file but when I open the file, each line has 3 dots at the end and the line isn’t complete. This is with using out-file.

When I use Export-Clixml the XML that is returned from the query is dumped in a tag called <props> which is not one of my tags.

I am unsure where to go from here to save my XML in it’s original format.

The PowerShell Script that I am using is similar to this:

Answer:

You need to convert the data into XML
Try this:

or this

Source:

Formatting XML from PowerShell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply