Hi LucD, I am using from old thread the below script
Get-VMHost|
Sort-Object-PropertyName|
SelectName,
@{N="Uptime";E={New-Timespan-Start$_.ExtensionData.Summary.Runtime.BootTime-End (Get-Date) |Select-ExpandPropertyDays}},
@{N="Date when script was run";E={Get-Date}} |
Export-Csvc:\uptime.csv-NoTypeInformation-UseCulture
Getting below output but i need the format i have mentioned before
Name";"Uptime";"Date when script was run"
"host1";"38";"2020-06-14 12:06:09"
"host2";"37";"2020-06-14 12:06:09"
"host3";"38";"2020-06-14 12:06:09"
"host4";"142";"2020-06-14 12:06:09"
Thanks
Ranjith