How many hosts and VM's in Virtual Center

More stats for my capacity report, this time numbers of VM’s in total in Virtual Center and average per host in each cluster. Obviously performance is not based on the numbers of VM’s per host, but its an interesting figure to keep track of.

Connect-VIServer virtualcenter | Out-Null

Total number of hosts $TotalVMHosts = Get-VMHost $TotalVMHostsCount = $TotalVMHosts.count Write-Host “There are $TotalVMHostsCount Hosts in $DefaultVIServer” # Total number of guests $TotalVMs = Get-VM $TotalVMsCount = $TotalVMs.count Write-Host “There are $TotalVMsCount Virtual Machines in $DefaultVIServer” $Clusters = Get-Cluster foreach ($Cluster in $Clusters){ $VMHosts = Get-Cluster $Cluster | Get-VMHost $VMs = Get-Cluster $Cluster | Get-VM $AverageVMsPerCluster = [math]::round(($VMs.count / $VMHosts.count), 1) Write-Host “$Cluster has $AverageVMsPerCluster guests per VMware host”

}