The below script is running in a for-each loop and the output heading is not coming in the right order. I want the output order as I mentioned in the hash table. I want the CSV table column heading in right order, not the data inside the table.
Like 1.Machine_Name, 2.Ping_Status, 3.OS_Name
How can I solve this?
$Result = @{
MACHINE_NAME = "$_"
PING_STATUS = "MACHINE ONLINE"
OS_NAME = "$OSNAME"
}
$Details += New-Object PSObject -Property $Result
$Details | export-csv -Path $pathofcsv -NoTypeInformation