PowerCLI Script to Get Number of CPUs, RAM and Provisioned HDD Size

February 25, 2016 Jordansphere VMware

The following script looks at particular folder (finance) on a vCenter Server then for each VM gets the number of CPUs, memory in GB and calculates the combined size of all HDDs. This is then exported to a csv file.

 

Connect-VIServer -Server {hostname} -User {username} -Password {password}

Get-Folder 'Finance' | Get-VM | Sort Name -descending| 
Select-Object Name,NumCpu, MemoryGB, @{n="HardDiskSizeGB"; e={(Get-HardDisk -VM $_ | 
Measure-Object -Sum CapacityGB).Sum}} | 
export-Csv c:\tmp\report.csv

 

combined, CPU, esxi, HDD, memoryGB,

Powered by WordPress. Designed by elogi.