Output variable as XML

I'm trying to read a number of values into the console, and populate an XML file with them. I've already managed to append an XML file and insert values into an existing XML file to populate empty nodes but I was looking at generating a new one from a large string. Something along the lines of:

1) set the the value of a variable to the header of the xml document.

2) read in a value and concatenate it to the variable.

3) do the same thing a few more times for some more values.

4) add the xml footer.

5) then output the big long variable as a formatted xml file.

I've seen a few articles on how to go about doing this but I can't get it to work so I've come up with nothing. Any ideas?

Thanks in advance

May 27th, 2014 12:01pm

Hi Bobbinspenguin,

If you want to convert the output to xml file, please try something like this:

$a=get-date
($a|convertto-xml).Save("d:\test.xml")
I hope this helps.
Free Windows Admin Tool Kit Click here and download it now
May 28th, 2014 4:01am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics