VMware Cloud Community
esarakaitis
Enthusiast
Enthusiast

Compare hostname of VM with display name of VM

$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

0 Kudos
1 Reply
packetboy
Contributor
Contributor

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 !!

0 Kudos