Automation

 View Only
Expand all | Collapse all

possible to get DNS info for VMhost?

  • 1.  possible to get DNS info for VMhost?

    Posted Jan 28, 2011 08:47 AM

    looks like my script doesn't work.

    Get-VMHost |Get-View |Select Name, @{N="DSN servers";E={(Get-View -Id

    $_.configManager.networkSystem).networkConfig.dnsConfig.address}}



  • 2.  RE: possible to get DNS info for VMhost?

    Posted Jan 28, 2011 08:52 AM

    If you're using PowerCLI 4.x you can do

    Get-VMHost | ` 
    Select
    Name, @{N="DSN servers";E={(Get-View $_.Extensiondata.configManager.networkSystem).networkConfig.dnsConfig.address}}


  • 3.  RE: possible to get DNS info for VMhost?

    Posted Jan 28, 2011 09:04 AM

    only get DNS info for some of the servers (ESX 3.0)... the rest of them are running ESX 3.5.

    I also tried using "Get-VMHostNetwork". The error msg was "Get-VMHostNetwork        Object reference not set to an instance of an object."

    Get-VMHost | Get-VMHostNetwork | Select Hostname, DNSAddress -ExpandProperty ConsoleNic |

    Select Hostname,  DNSAddress



  • 4.  RE: possible to get DNS info for VMhost?

    Posted Jan 28, 2011 09:09 AM

    Sorry, don't have any ESX 3.x left to test against.

    Isn't just

    Get-VMHost | Get-VMHostNetwork | Select Hostname, DNSAddress

    enough to see the DNS IP addresses ?



  • 5.  RE: possible to get DNS info for VMhost?

    Posted Jan 28, 2011 10:30 AM

    returned same error ""Get-VMHostNetwork        Object reference not set to an instance of an object."



  • 6.  RE: possible to get DNS info for VMhost?

    Posted Jan 28, 2011 10:38 AM

    Which version of PowerCLI are you using ?

    Get-PowerCLIVersion

    And which ESX 3.5 version ?

    Perhaps check if the ESX version is supported in the Release Notes.



  • 7.  RE: possible to get DNS info for VMhost?

    Posted Jan 30, 2011 03:38 AM

    VMware ESX Server 3.5 Update 5 Build 207095. Powercli version is 4.1 U1 build 332441.



  • 8.  RE: possible to get DNS info for VMhost?

    Posted Jan 30, 2011 10:11 AM

    Strange, ESX 3.5U5 is supported.

    Perhaps someone with an ESX 3.5U5 running can do the same test ?



  • 9.  RE: possible to get DNS info for VMhost?

    Posted Feb 02, 2011 04:16 AM

    I don't have any 3.5 U5 hosts in the environment, but I do still have some older 3.5 U4 hosts.  Every single one of these scripts works on those hosts for me.  Not sure what is going on with your environment, but for what it is worth, here's another option to try that should be a little quicker (if it works):

    Get-View -ViewType HostSystem -Property Config.Network.DnsConfig.Address,Name | Select-Object Name, @{N="DNS Servers";E={$_.Config.Network.DnsConfig.Address}}



  • 10.  RE: possible to get DNS info for VMhost?

    Posted Feb 09, 2011 03:03 AM

    This script is much faster. However, it returns same results only showing DNS servers for ESX 3.0.2. The strange thing is that it doesn't work on any version of ESX 3.5. Is it because vCenter version is too old?



  • 11.  RE: possible to get DNS info for VMhost?

    Posted Feb 09, 2011 06:09 AM

    What version of vCenter are you using?  Have you tried connecting directly to one of the ESX 3.5 U5 hosts to see if that makes a difference?



  • 12.  RE: possible to get DNS info for VMhost?

    Posted Feb 09, 2011 06:20 AM

    vCenter v2.5. I tried connecting to single VMhost (ESX 3.5) , doesn't make sense....still returned nothing, no error msg.



  • 13.  RE: possible to get DNS info for VMhost?

    Posted Feb 09, 2011 10:23 AM

    deleted



  • 14.  RE: possible to get DNS info for VMhost?

    Posted Feb 09, 2011 01:23 PM

    He's trying to get the DNS server information from his ESX hosts, not his VMs.



  • 15.  RE: possible to get DNS info for VMhost?

    Posted Feb 09, 2011 01:36 PM

    I have no problems with all the scripts on this thread running against ESX 3.5U5 servers. Everything works fine for me. Connected to a vCenter 4.1 Server or directly connected to an ESX 3.5U5 server.

    Regards, Robert



  • 16.  RE: possible to get DNS info for VMhost?

    Posted Feb 10, 2011 08:03 AM

    The problem is with vCenter. It's unable to show DNS servers for those VMhosts using VI client. I have tried connecting from different workstations.



  • 17.  RE: possible to get DNS info for VMhost?

    Posted Feb 10, 2011 02:07 PM

    Here's the million dollar question then.  Are you sure you've got DNS servers configured on these hosts?  If it isn't showing up in PowerCLI or the VI Client...



  • 18.  RE: possible to get DNS info for VMhost?

    Posted Feb 11, 2011 03:04 AM

    configured name servers in /etc/resolv.conf