fborges555
Enthusiast
Enthusiast

List of DNS server assigned to VM

Hi gurus.

 

I am looking for a script the bring me the information of the DNS server/IP that a VM has 

Get-vm | select name , Here is where I am having trouble getting the DNSserver for the vm

 

Thanks 

Reply
0 Kudos
LucD
Leadership
Leadership

That info is coming from the Guest OS, so it is not available for all operating systems.
For most Windows OS, and provided VMware Tools are running, you can do

Get-VM |
Select-Object Name, @{N = 'DNSServers'; E = { $_.ExtensionData.Guest.Net.dnsconfig.ipaddress -join '|'}}


To have this info for types of Guest OS, you could consider running a Guest OS native script

 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
fborges555
Enthusiast
Enthusiast

LucD

 

worked like a charm , thanks a bunch

Reply
0 Kudos