Hi,
Below is changes made for only ( Free Memory & CPU ) as per your instructions,
$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)/100}},
@{N='Memory Capacity GB';E={[math]::Round($_.MemoryTotalGB,2)}},
@{N='Memory Used GB';E={[math]::Round($_.MemoryUsageGB,2)}},
@{N='Memory Free %';E={[math]::Round(($_.MemoryTotalGB - $_.MemoryUsageGB),2)/100}},
@{N='Timestamp';E={$time}}|
Export-Csv -Path c:\temp\ramdisk\Utilisationreport3.csv -NoTypeInformation -UseCulture
Below is the Ooutput.
| CPU GHz Capacity | CPU GHz Used | CPU GHz Free % | Memory Capacity GB | Memory Used GB | Memory Free % | Timestamp |
| 79.8 | 54.76 | 0.2504 | 1023.65 | 737.62 | 2.8603 | 04-12-2020 14:20 |
| 79.8 | 57.71 | 0.2209 | 1023.65 | 459.15 | 5.645 | 04-12-2020 14:20 |
Kindly let me whether OUT is correct, If yes... How I place percentage symbol next to Value as per Below
| CPU GHz Capacity | CPU GHz Used | CPU GHz Free % | Memory Capacity GB | Memory Used GB | Memory Free % | Timestamp |
| 79.8 | 54.76 | 0.25% | 1023.65 | 737.62 | 2.86% | 04-12-2020 14:20 |
| 79.8 | 57.71 | 0.22% | 1023.65 | 459.15 | 5.65% | 04-12-2020 14:20 |
Thanks,
Kumar