Get-VMSummary is not retrieving IP address of Virtual Machines

Feb 8, 2010 at 11:51 AM

I have written a powershell script to execute one batch file from host machine to  virtual machine. For that, i included Get-VMSummary command to get FQDN and IP address in my script. but Get-VMSummary is not retrieving IP address and FQDN Name of virtual machine.

 

Can anyone help on this?

Feb 8, 2010 at 7:32 PM

Simply put, the IP resolution is based off of the FQDN.  If Integrated Components are installed, you can pass data that way.  I use that approach for scripting imaging VMs automation.  Either via batch or vbs, add a reg entry containing the VMs' ip, then retrieve on the host. 

ie.

vm:

FOR /F "tokens=2* " %%a IN ('REG Query "HKCU\Control Panel\International" /v sLanguage ^| find "sLanguage"') DO SET LANG=%%b

reg add "HKLM\Software\Microsoft\Virtual machine\auto" /v LANG /t REG_SZ /d %LANG% /f

host:

(get-vmkvp -server novamonitor -vm ImagingVM_jpn).lang

 

Now, if you are facing the problem of a domain joined VM not resolving address, then that's a whole separate issue.

Coordinator
Feb 10, 2010 at 9:38 AM

Just an additional piece of information .

Get-VMSummary uses Get-VMKvp.

In the first release of hyper-V the Key/Value pair integration component returns the FQDN and (as NMELNIK says) Get-VMSummary resolves that to an IP Address using DNS. If the host and guest aren't using the same DNS you can expect this to fail.

In Hyper-V R2 there are some extra KVPs these include the IPv4 and IPv6 addresses and the address that the VM listens for RDP connections. This is more reliable but I didn't change the code in get-vm summary. (If I did I would please some people by removing the dependancy on DNS , and annoy others by no longer testing DNS).

If the VM is stopped, or the KVP exchange integration components isn't installed and working then there is no way to get this information.  My guess if you are not getting FQDN in the summary is that you Get-VMKVP not able to get any information. I'd try that on its own and then check the integration components (if the VM isn't a supported version of Windows then you won't get any KVP data).

 

Feb 10, 2010 at 10:12 AM

Hi,

I upgraded integration services components in my guest machine. This resolved my issue.Thanks to NMELNIK and iamesone for helping me to get around this.

 

Feb 10, 2010 at 10:37 AM
Edited Feb 10, 2010 at 11:00 AM

Hi,

 

I was able to get FQDN in Get-VMSummary command but i don't get ip address of guest machine in Get-VMSummary command. Get-VMKVP shows ip address of guest machine. My guest machine is Windows server 2003 sp2. I need Get-VMSummary to give Ip address of VM. Is there any way to get around this?

 

Moreover, i have two virtual machines, windows server 2008 and windows server 2003. For Windows server 2008, Get-VMSummary gives all details including ip address and FQDN. but It doesn't give ip for Windows server 2003. I also found that Ping-VM command is working for Win2k8 not for Win2k3.

 

Thanks in advance