VMware Cloud Community
virtualg_uk
Leadership
Leadership

PowerCLI Report: Get Datacenter, #cluster & stats

I'm looking to run a PowerCLI script to return a table with the headings as follows:

Datacenter | Number of Clusters | Total CPU (GHz) | Total Memory (GB)

Many thanks


Graham | User Moderator | https://virtualg.uk
0 Kudos
1 Reply
LucD
Leadership
Leadership

Try something like this

Get-Datacenter | ForEach-Object{

    $cluster = Get-Cluster -Location $_

    $esx = Get-VMHost -Location $_

    $_ | Select Name,

    @{N='Cluster#';E={$cluster.Count}},

    @{N='CpuGhz';E={[math]::Round(($esx | Measure-Object -Property CpuTotalMhz -Sum | Select -ExpandProperty Sum)/1000,1)}},

    @{N='MemGB';E={[math]::Round(($esx | Measure-Object -Property MemoryTotalGB -Sum | Select -ExpandProperty Sum),1)}}

}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference