Try something like this
$time = Get-Date
Get-Cluster -PipelineVariable cluster |
Get-VMHost|
Select @{N='Cluster';E={$cluster.Name}},
@{N='VMHost';E={$_.Name}},
@{N='CPU GHz Capacity';E={[math]::Round($_.CpuTotalMhz/1000,2)}},
@{N='CPU GHz Used';E={[math]::Round($_.CpuUsageMhz/1000,2)}},
@{N='CPU GHz Free';E={[math]::Round(($_.CpuTotalMhz - $_.CpuUsageMhz)/1000,2)}},
@{N='Memory Capacity GB';E={[math]::Round($_.MemoryTotalGB,2)}},
@{N='Memory Used GB';E={[math]::Round($_.MemoryUsageGB,2)}},
@{N='Memory Free GB';E={[math]::Round(($_.MemoryTotalGB - $_.MemoryUsageGB),2)}},
@{N='Timestamp';E={$time}} |
Export-Csv -Path .\report.csv -NoTypeInformation -UseCulture
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference