List DNS Servers in Domain using PowerShell – Microsoft

In some cases, many of us would want to list DNS Servers in domain using powershell. There are plenty of custom written scripts to achieve this goal. However, since, there is already built in tool available for it, so why bothering to write own script for a simple task?

Use Powershell or CMD to list DNS Servers in Domain

A sample way out is open CMD or Powershell and start the NSLOOKUP utilitiy.  
PS C:\WINDOWS\system32> nslookup
Default Server:  dc.contoso.com
Address:  192.168.160.91

  Next, In order to get the list of DNS Servers in domain, set the type to NS and finally, type your Root Domain Name and press Enter.
PS C:\WINDOWS\system32> nslookup
Default Server:  dc.contoso.com
Address:  192.168.160.77

> set type=NS
> contoso.com
Server:  dc.contoso.com
Address:  192.168.160.77


contoso.com     nameserver = dc1.contoso.com
contoso.com     nameserver = dc2.contoso.com
contoso.com     nameserver = dcq.contoso.com

dc1.contoso.com       internet address = 192.160.1.93
dc2.contoso.com       internet address = 192.160.1.55
dcq.contoso.com       internet address = 192.160.1.35
  Above list will list DNS Server in your domain. Additionally, PowerShell commands related to DNS Server can be found in here at Microsoft’s official website.

Share your thoughts

*