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}}
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}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
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 ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
returned same error ""Get-VMHostNetwork Object reference not set to an instance of an object."
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.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
VMware ESX Server 3.5 Update 5 Build 207095. Powercli version is 4.1 U1 build 332441.
Strange, ESX 3.5U5 is supported.
Perhaps someone with an ESX 3.5U5 running can do the same test ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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}}
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?
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?
vCenter v2.5. I tried connecting to single VMhost (ESX 3.5) , doesn't make sense....still returned nothing, no error msg.
deleted
He's trying to get the DNS server information from his ESX hosts, not his VMs.
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
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.
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...
configured name servers in /etc/resolv.conf