locked
List all DNS servers in an AD Forest RRS feed

  • Question

  • Is there a way (preferably powershell, of course!) to find all DNS servers in an AD forest?  Not domain controllers running DNS but ANY Windows servers running DNS.

    Here is the situation...I have one root domain to which I am adding a new domain controller.  There are roughly 20 child domains which should all have their dns servers set to forward to my root domain for unresolved queries.  I need to change the forwarders on all DNS servers in the Forest (I've got that part figured out).  However, I know that not all Domain Controllers in all of the domains are DNS servers and vice versa (not all DNS servers in the domains are domain controllers).

    So...anything that I can query to find all dns servers in the Forest (short of querying every server in the Forest for the existence of the DNS Server service?)
    I've searched but can't seem to find anything in wmi.

    Thanks,
    Nate
    Wednesday, September 30, 2009 11:58 PM

Answers

  • I know this is an older post, but for people still looking for an answer. NSLOOKUP will do the job, use the "Set Type=NS" option and the root domain name. This will return all DNS servers in the root and child domains.

    NSlookup

    Set type=NS

    "type your root domain name here"

    Hope this helps, BTW you should regularlly run DNSLINT on all DNS servers to insure a healthy environment.

    • Proposed as answer by SJSabo Monday, August 9, 2010 2:06 PM
    • Marked as answer by nathanraper Monday, August 9, 2010 8:28 PM
    Monday, August 9, 2010 2:05 PM
  • Hi Nate,

    As far as I know, there is no built-in feature to find all DNS server in Forest. You may try the following steps:

    1.    Run "ipconfig /all >> \\server\share\ip.txt" on all clients to collect their IP settings which includes DNS settings. Configure a logon script or use PsExec
    http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

    2.    After that, based on your environment, try "findstr /c:"DNS Servers" \\server\share\ip.txt >>\\server\share\dns.txt" or "findstr ^[1-9]\.[1-9] \\server\share\ip.txt >>\\server\share\dns.txt ".

    3.    You can manually find all DNS server or script more to find all DNS.

    If you have any difficulties when you customizing the scripts, I suggest that you initial a new post in The Official Scripting Guys Forum! to get further support there. They are the best resource for scripting related problems.

    For your convenience, I have list the link as followed.

    The Official Scripting Guys Forum!
    http://social.microsoft.com/Forums/en-US/ITCG/thread/34ed6cba-7698-4aa8-b13c-8693081296ef 

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.
    • Marked as answer by Mervyn Zhang Tuesday, October 6, 2009 10:02 AM
    Friday, October 2, 2009 3:58 AM

All replies

  • Hi

    Please try the below links, it will provide even DNS server seetings...

    http://support.microsoft.com/kb/555980

    http://support.microsoft.com/kb/555981

    Regards
    Rajesh J S
    Thursday, October 1, 2009 3:33 AM
  • Considering that you have a mix of AD-integrated and primary/secondary zones, you would have to identify all computers running Windows Server OS and determine which of them have DNS Server service running...

    hth
    Marcin

    Thursday, October 1, 2009 11:51 AM
  • Hi Nate,

    As far as I know, there is no built-in feature to find all DNS server in Forest. You may try the following steps:

    1.    Run "ipconfig /all >> \\server\share\ip.txt" on all clients to collect their IP settings which includes DNS settings. Configure a logon script or use PsExec
    http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

    2.    After that, based on your environment, try "findstr /c:"DNS Servers" \\server\share\ip.txt >>\\server\share\dns.txt" or "findstr ^[1-9]\.[1-9] \\server\share\ip.txt >>\\server\share\dns.txt ".

    3.    You can manually find all DNS server or script more to find all DNS.

    If you have any difficulties when you customizing the scripts, I suggest that you initial a new post in The Official Scripting Guys Forum! to get further support there. They are the best resource for scripting related problems.

    For your convenience, I have list the link as followed.

    The Official Scripting Guys Forum!
    http://social.microsoft.com/Forums/en-US/ITCG/thread/34ed6cba-7698-4aa8-b13c-8693081296ef 

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.
    • Marked as answer by Mervyn Zhang Tuesday, October 6, 2009 10:02 AM
    Friday, October 2, 2009 3:58 AM
  • Hi,

    Do you need any other assistance? If there is anything we can do for you, please let us know.

    Thanks.

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, October 8, 2009 8:46 AM
  • I know this is an older post, but for people still looking for an answer. NSLOOKUP will do the job, use the "Set Type=NS" option and the root domain name. This will return all DNS servers in the root and child domains.

    NSlookup

    Set type=NS

    "type your root domain name here"

    Hope this helps, BTW you should regularlly run DNSLINT on all DNS servers to insure a healthy environment.

    • Proposed as answer by SJSabo Monday, August 9, 2010 2:06 PM
    • Marked as answer by nathanraper Monday, August 9, 2010 8:28 PM
    Monday, August 9, 2010 2:05 PM
  • it may be an old thread but at least i have a solution for next time!  Thanks for the reply!

     

    • Proposed as answer by SOmilianowski Tuesday, April 10, 2018 1:46 PM
    Monday, August 9, 2010 8:29 PM
  • I know this is an older post, but for people still looking for an answer. NSLOOKUP will do the job, use the "Set Type=NS" option and the root domain name. This will return all DNS servers in the root and child domains.

    NSlookup

    Set type=NS

    "type your root domain name here"

     

     

    Love this solution- exactly what I was looking for <3

     

    Friday, October 29, 2010 6:11 PM
  • Hi Nate, 

    Yes, we can find list of DNS servers by using a command "nltest".

    Here is the syntax nltest/dnsgetdc:<forest name>

    example: nltest/dnsgetdc:microsoft.com


    Saturday, March 17, 2012 10:19 AM
  • That would just list all DCs within a domain (not even in the entire forest).
     
    You can use DNSLint (http://support.microsoft.com/kb/321045) or dnscmd (assuming you’re hosting your AD DNS Zones on Microsoft DNS Servers) to query for NS records.
     
    ----------------------------------------------------------
    Regards
    Christoffer Andersson – Principal Advisor
    Enfo Zipper

    "EXRAPUL" wrote in message news:ea6d0f00-0bc0-4786-b63b-c618e51ff264...

    Hi Nate,

    Yes, we can find list of DNS servers by using a command "nltest".

    Here is the syntax nltest/dnsgetdc:<forest name>

    example: nltest/dnsgetdc:microsoft.com



    Enfo Zipper Christoffer Andersson – Principal Advisor
    Tuesday, March 20, 2012 7:15 AM
  • Your answer FTW
    Friday, November 15, 2013 4:38 PM
  • How about an ldap query?

    (servicePrincipalName=DNS*)

    Tuesday, October 14, 2014 9:06 PM
  • set q=NS

    but it lists NS servers from your domain forward lookup zone...so it doesn't mean that you cannot have DNS service installed somewhere else...because these records can be manually changed.


    • Edited by EwasHX Monday, November 23, 2015 11:15 PM
    Monday, November 23, 2015 11:15 PM
  • Or maybe nslookup and set type=soa aswell to see where the zone comes from (in a windows environment of course)

    Freddy

    Wednesday, February 3, 2016 9:42 AM
  • If you have Win2012 R2 and above, you can use the Resolve-DnsName cmdlet:

    Resolve-DnsName domain.com -type ns | ? {$_.type -eq "A"} | select name, IP4Address

    This will show all DNS servers for domain.com and their IP addresses:

    Friday, September 7, 2018 4:52 AM