Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find out what each server in my domain is using for dns

Status
Not open for further replies.

ancientcontra

Technical User
Jun 30, 2005
42
GB
Hi we have recently decomissioned a DNS server, and I wanted to know if there was a script I could use to search the directory looking for all the dns servers that are being used by the servers, as obviously they have been set manually.

ANY help would be magic!

Nick Cutting
MSCA CCNA A+ CCNP
 
After I have a text file with a list of servers I can then use psexec to run :

psexec \\<servername> ipconfig /all > dns.txt

then extract all the dns info to another file ? exect I have no idea how

Nick Cutting
MSCA CCNA A+ CCNP
 
forget about searching AD for the information, as its not held there.

if you go off of your plan, you should be able to follow up with a find /i "DNS" <path to file> to search teh file for the DNS server.

you could also pull this information from the registry....specifically inside of HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\<NIC GUID>

the value in there is called NameServer

-Brandon Wilson
MCSE:Security00/03
MCSA:Messaging00
MCSA:Security03
A+

 
hey I figured it out with Powershell. Thanks for the tips

Where snick is my server list :

$cred = get-credential

Function Check-DNS
{
Write-host "DNS servers for $strComputer"
Get-WmiObject -Class Win32_NetworkAdapterConfiguration -comp $strComputer | select-object -property DNSServerSearchOrder
Write-host "_____________________________________________________"

}

foreach ($strComputer in get-content c:\snick.txt)
{
Check-DNS
}

Nick Cutting
MSCA CCNA A+ CCNP
 
there ya go..powershell is pulling from the registry locations, as a wmi call would in a vbscript, so youll definitely be good to go. im glad you got it worked out :)

-Brandon Wilson
MCSE:Security00/03
MCSA:Messaging00
MCSA:Security03
A+

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top