Hi,
I would like to know if there any sample code to retrieve the ip address of the vms on vcenter?
Thanks in advance.
Are you looking to use any specific language? PowerCLI perhaps?
Maish
Hi,
I'm actually looking at c# code. I have downloaded the vsphere sample for the vsphere web service sdk but cant seems to find any sample related to retrieve the IP address of VM other than its properties value like vm name.
Hi,
Yes we can retrieve the IpAddress of a VM using
((Vim25Api.VirtualMachineSummary)(objVM)).guest.ipAddress but this API does not return IP Addresses of all the VM of a particular ESX
The IP Address being returned from the guest is only available if they're running VMware Tools, it could alos be the case that it's installed but not running. That's how that property is being populated.
Hi,Does anyone have a sample of the code on how it works as i have no idea where to start from? Currently i'm able to retrieve the VM IP address thru vsphere power cli but i looking at using web service sdk instead. Thanks
Hi,
Can you please elaborate on what code exactly do u need. I have retrivied IP address using vpshere sdk only.
object objVM = svc.GetDynamicProperty(ocary[i].obj, "summary"); where svc is webservice object
((Vim25Api.VirtualMachineSummary)(objVM)).guest.ipAddress