The PowerShell scripts which are listed on this page, require VMware vSphere PowerCLI. Before you execute one of these scripts, make sure you’re connected to your Virtual Infrastructure using the following command:
Connect-VIServer -Server "VISERVER"
Get VM count per host
Displays the number of virtual machines per VMware host.
Get-VMHost | Select-Object Name, @{n="VMs";e={($_ | Get-VM).Count}}
Output:
Name VMs ---- --- hst-s01-01.care.lan 44 hst-s01-02.care.lan 43 hst-s01-03.care.lan 35 hst-s01-04.care.lan 35 hst-s01-05.care.lan 35 hst-s01-06.care.lan 36