Trying to find a simple script that will output to a CSV a list of VMs and which host they currently are under but no luck so far. Closest I’ve found is Alan Renouf’s one below that lists the number of VMs per host but not the actual names.
Get-VMHost | Select @{N=“Cluster“;E={Get-Cluster -VMHost $_}}, Name, @{N=“NumVM“;E={($_ |Get-VM).Count}} | Sort Cluster, Name | Export-Csv -NoTypeInformation c:\clu-host-numvm.csv
Im sure it’s something along the simple lines of get-vmhost | get-vm but need the host listed. Any ideas?