VMware {code} Community
karnowski
Contributor
Contributor

Getting the DNS name servers from an existing virtual machine?

I can set the DNS name servers successfully (by using the CustomizationGlobalIPSettings object), but how do I get the list of DNS name servers from an existing virtual machine through vSphere's web API? I'm trying to get the values of the "nameserver" lines in the /etc/resolv.conf file for a Linux VM.

0 Kudos
1 Reply
lamw
Community Manager
Community Manager

afaik, this is not available via the VI/vSphere API, if you have VMware Tools installed, you can get the following networking information from a VM: http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/index.html

You may want to take a look at VMware VIX API which can do this but the current 1.6.2 version does not support vSphere, just VI 3.5

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

If you find this information useful, please award points for "correct" or "helpful".