The VSphere GUI client can tell me what a virtual machine's IP and DNS are. I am trying to find a way to get that information out of "vi tools" Powershell CLI and can't see how. Get-VM can get me the VM and the .NetworkAdapters Property tells me stuff about the adapter(s) on the VM - but I can't see how to find the IP and DNS name.
jj
I am making progress
Get-VMGuest will get me the IP address. How can I get the DNS name that VMWare knows about?
OK, I have figured it out. Get-VMGuest objects also have a property called 'HostName' which turns out to be what the GUI client displays as DNS.
how about:
$VMs = Get-VM foreach ($VM in $VMs){ $VM = Get-View $VM.ID $nm = $VM.name $hn = $VM.guest.hostname $ip = $VM.guest.ipaddress $vm | select @{Name = "Name"; Expression = {$nm}}, @{Name = "Hostname"; Expression = {$hn}}, @{Name = "IP"; Expression = {$ip}} }