Pages: [1]
Print
Author Topic: Compare hostname of VM with display name of VM  (Read 1177 times)
esarakaitis
Administrator
Sr. Member
*****
Posts: 256


8223109 sack57@hotmail.com littleking57 rootinfortwayne
View Profile WWW Email
« on: February 05, 2009, 10:59:49 AM »

Code:
$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}}
    }
Logged
Pages: [1]
Print
Jump to: