Category Archives: Uncategorized

One-liner for cluster information

Get-Cluster | Select Name,@{N="NumHosts";E={($_ | get-vmhost).Count}},@{N="TotalGB";E={[math]::Round(($_ | Get-VMHost |Measure-Object -Sum MemoryTotalGB).Sum,0)}},@{N="Capacity N-1";E={[math]::Round((($_ | Get-VMHost |Measure-Object -Sum MemoryTotalGB).Sum / ($_ | get-vmhost).Count) * (($_ | get-vmhost).Count-1),0)}},@{N="TotalUsedGB";E={[math]::Round(($_ | Get-VM| where {$_.PowerState -eq "PoweredOn"}|Measure-Object -Sum MemoryGB).Sum,0)}},@{N="Free";E={[math]::Round((($_ | Get-VMHost |Measure-Object -Sum MemoryTotalGB).Sum / ($_ | get-vmhost).Count) * (($_ | get-vmhost).Count-1) - ($_ | Get-VM| where {$_.PowerState -eq "PoweredOn"}|Measure-Object -Sum MemoryGB).Sum,0)}},@{N="VM Count"; E={($_ | Get-VM).Count}} | Sort-Object Name | ft -AutoSize

Results look like this:
Name NumHosts TotalGB Capacity N-1 TotalUsedGB Free VM Count
---- -------- ------- ------------ ----------- ---- --------
Cluster 1 4 3071 2304 2034 270 345
Cluster 2 2 768 384 172 212 11
Cluster 3 2 1024 512 431 81 117

 

Ramblings of a mad man

Here you will find ramblings of a mad virtual-guy.

This site is aimed at myself and myself only, all posts here are just my thoughts put on virtual paper and might brake your systems if you try to apply them blind.