Newbie Kickstart for XML and CSV

by Oct 3, 2015

Hi guys,

Apologies in advance as I'm relatively new to powershell.

I have an XML file and from this file I pull in some data and can successfully send this to a text file. However I'd like to manipulate the data by mutiplying by a fixed number and sending it to a CSV that I could append with the output from another number.

Is my approach that follows correct or should I be doing something else?

[xml]$xmldata = Get-Content data.xml
$ > outfile.txt

#up to here, I'm good, this works

#what follows does not work

$ > $xmldata_object1
$xmldata_object1 = [int]$xmldata_object1/1024
$ > $xmldata_object2
$xmldata_object2 = [int]$xmldata_object2/1024

#if I try to write-host or write-output of $xmldata_object1 or $xmldata_object2 it fails as does any attempt I try for CSV.