Batch Script to check DNS

Batch Script to check DNS results from different DNS Servers

Normal DNS propogation maximum time is 24 hr to 48 hrs. but usually servers start updating from first hour itself. Server changes and Name server changes usually happen when we migrate Hosting accounts. It is a challenging task for webmasters to get the right DNS reply. In this situation, we use to test popular public dns servers staus. How to use NSlookup command to query results from different servers ? simply add the DNS server Ip address after the domain name you want to search. for example check binbert.com result from google.com.

nslookup binbert.com 8.8.8.8

For OpenDNS it is

nslookup binbert.com 208.67.222.222

There are many popular DNS services which we can use. it include Norton DNS, Level3, Verizon etc.

This script will prompt the domain name and set the value to variable. then check the dns status with nslookup command in each public dns servers.
finally output will display in a single window. If you dont know how to create a batch file, Simly copy below code to a text editor and save as filename.bat. Make sure that you are not assign name as “nslookup.bat” It will conflict with nslookup.com command
Looking forward for your feedback

Code :

:: version 1.0
 echo off
 Title Mass DNS testing script by www.binbert.com
 cls
 echo.
 echo.
 set /p domainname=Enter Domain Name :
 cls
 echo.
 for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% ^| find /v "Aliases"') do set my_dns_result=%%a
 cls && echo. && echo. && echo Collecting data && echo.
 echo. [####* ]
 for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 8.8.8.8 ^| find /v "Aliases"') do set google_result=%%a
 cls && echo. && echo. && echo Collecting data && echo.
 echo. [#######* ]
 for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 208.67.222.222 ^| find /v "Aliases"') do set OpenDNS_result=%%a
 cls && echo. && echo. && echo Collecting data && echo.
 echo. [##########* ]
 for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 216.146.35.35 ^| find /v "Aliases"') do set DynDNS_result=%%a
 cls && echo. && echo. && echo Collecting data && echo.
 echo. [#############* ]
 for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 198.153.192.50 ^| find /v "Aliases"') do set Norton_DNS_result=%%a
 cls && echo. && echo. && echo Collecting data && echo.
 echo. [################* ]
 for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 8.26.56.26 ^| find /v "Aliases"') do set combo_result=%%a
 cls && echo. && echo. && echo Collecting data && echo.
 echo. [###################* ]
 for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 156.154.70.1 ^| find /v "Aliases"') do set DNS_Advantage_result=%%a
 cls && echo. && echo. && echo Collecting data && echo.
 echo. [######################* ]
 for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 4.2.2.2 ^| find /v "Aliases"') do set Verizon_result=%%a
 cls && echo. && echo. && echo Collecting data && echo.
 echo. [#########################* ]
 for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 209.244.0.3 ^| find /v "Aliases"') do set Level3_result=%%a
 cls && echo. && echo. && echo Collecting data && echo.
 echo. [############################* ]
 for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 81.218.119.11 ^| find /v "Aliases"') do set GreenTeamDNS_result=%%a
 cls && echo. && echo. && echo Collecting data && echo.
 echo. [###############################* ]
 for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 195.46.39.39 ^| find /v "Aliases"') do set SafeDNS_result=%%a
 cls && echo. && echo. && echo Collecting data && echo.
 echo. [##################################* ]
 for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 208.76.50.50 ^| find /v "Aliases"') do set SmartViper_result=%%a
 cls && echo. && echo. && echo Collecting data && echo.
 echo. [#####################################*]
 cls
 echo. && echo.
 echo. Results from various DNS server for Domain %domainname%
 echo.
 echo. Searched for A-Record
 echo. && echo. && echo.
 echo Result from Your DNS Settings : %my_dns_result%
 echo Result from Google DNS : %google_result%
 echo Result from OpenDNS : %OpenDNS_result%
 echo Result from Norton DNS : %Norton_DNS_result%
 echo Result from Combo Secure DNS : %combo_result%
 echo Result from DNS Advantage : %DNS_Advantage_result%
 echo Result from Verizon : %Verizon_result%
 echo Result from Level3 : %Level3_result%
 echo Result from GreenTeam DNS : %GreenTeamDNS_result%
 echo Result from Safe DNS : %SafeDNS_result%
 echo Result from SmartViper DNS : %SmartViper_result%
 echo Result from DynDNS : %DynDNS_result%
 echo. && echo. && echo.
 Pause

About Albin Sebastian

I am a Technology Blogger, System Administrator by profession and webmaster by passion. Technology blogger, Active in Online and offline tech communities.

Check Also

ftp commands from batch script

This article explained how to automate the ftp activities from batch file. It will helps …