Can someone help me to transpose row into colums. Need to transpose MachineName into columns.
Endtime must be sorted.
<#MachineName, TotalDataSizeBytes, ActualStartTime, EndTime, FinalJobStatus
SERVER1, 322349304901, 28/02/2016 23:00:03, 29/03/2016 23:33:23, OK
SERVER1, 322349304902, 26/02/2016 23:00:03, 27/03/2016 23:33:23, OK
SERVER2, 322349304903, 28/02/2016 23:00:01, 29/03/2016 23:33:23, OK
SERVER2, 322349304904, 26/02/2016 23:00:01, 27/03/2016 23:33:23, OK
#>
$graph = Import-Csv d:\report3.csv | foreach {
New-Object PSObject -prop @{
EndTime = [DateTime]::Parse($_.EndTime);
MachineName = $_.MachineName;
TotalDataSizeBytes = $_.TotalDataSizeBytes
}
}
#Desired result in a csv file.
#EndTime,SERVER1,SERVER2
#27/03/2016 23:33:23,322349304902,322349304904
#29/03/2016 23:33:23,322349304901,322349304903
Edit1. Found a similar question:
http://stackoverflow.com/questions/33906500/powershell-csv-row-column-transpose-and-manipulation