Powershell: VMware one liner to list total vm that are powered on each host

This one liner will query each host and id its cluster total vms and how many VMs are powered on
Get-VMHost | Select @{N="Cluster";E={Get-Cluster -VMHost $_}}, Name, @{N="Total_VMs";E={($_ | Get-VM).Count}},@{N="Powered_On";E={($_ | get-vm | ? {$_.powerstate -like "*ON*"}).count}} | Sort Cluster, Name | fl


Popular posts from this blog

Powershell - Com+ Application Recycle

Powershell : Certutil Find Expired Certs on CA server