$VMs = Get-VM foreach ($VM in $VMs){ $VM = Get-View $VM.ID $nm = $VM.name $hn = $VM.guest.hostname $vm | select @{Name = "Name"; Expression = {$nm}}, @{Name = "Hostname"; Expression = {$hn}} }
http://www.vmwarescripting.com
hey mate thanks for this i was going to add this into my script to double check and you saved me heaps of time !
thanks !!