I'm working a Powershell script that creates and CSV from data pulled from and XML document. I created arrays for each data type, then create the CSV using those arrays.
The XML has a timestamp in UNIX time. I created an array with converted UNIX time to a more readable format but that array is not printing out to the CVS.
$StartTimeComp = [xml]$RMAudit.RMAudit.RMRecord.StartTime
foreach ($time in $StartTimeComp){
$StartTime += [System.TimeZone]::CurrentTimeZone.ToLocalTime(([datetime]'1/1/1970').AddSeconds($time))
}
$outArray = @()
foreach ( $newtime in $StartTime )
{
$outArray += New-Object PsObject -Property @{
'Start Time' = $NewTime}
}
$outArray | export-csv 'C:\location\Results.csv'