Hi Can somebody assist with a script to output the number of powered on vm's on each host allowing me to name a specific cluster on which to do this? I would like it to display the output in 2 columns; Host, NumVM,
I've been trying to amend something I found online which gives a similar output but it goes through all clusters:
Get-VMHost | Select @{N="Cluster";E={Get-Cluster -VMHost $_}}, Name, @{N="NumVM";E={($_ | Get-VM | where {$_.powerstate -eq "poweredon"}).Count}} | Sort Cluster, Name
That gives 3 columns and goes through the clusters..... which I don't want to do. I'd like to explicitly list a cluster name and just list the hosts/vm numbers in the output.