How to find ipaddresses of ESX Hosts (VMHosts) in a vcenter?
I have looked at the http://communities.vmware.com/message/780627#780627 as its related.
So i looked at the config.network proeprty but couldnt find the ipaddress of the host.
Looks like I am missing something obvious.
Can you help me find the actual property?
The ip addresses of the virtual nics for a host are buried in the networkInfo property of the HostSystem.
I just looked at your image and it looks like you should be using configManager.networkSystem.networkInfo.consoleVnic.spec.ip.ipAddress instead.
The problem with just going to config.network.vnic is that you will not know what vnic type it is (management, vmotion, etc).
The best solution is to use QueryNetConfig from HostVirtualNicManager. Use 'management' for the nicType (I'm assuming you want the management ip). That will return a list of HostVirtualNic. You can get the vmk device, mac and ip address quickly this way and it will support configurations where you have multiple management interfaces.
There are two option from where you can get the Host IP address.
1) Go to Home --> Inventory --> Host and Cluster --> Configuration --> Networking --> Management Network Ip is your host IP
2) If you have database access of VCenter then you can run the below query
select DNS_NAME,IP_ADDRESS from dbo.VPX_HOST