Solved

How to check the mx record for multiple domains

Posted on 2010-11-29
6
3,471 Views
Last Modified: 2015-08-25
I have the need to check the mx record for multiple domains (100+) on a montly basis to ensrue that the mx record has not changed. I can go to any of several web sites that allow me to check the mx, but I can only check one at at time which is time consuming. Is there a tool I can use that will allow me to enter multiple domains to retrieve the mx information all at one time? Thanks!
0
Comment
Question by:myester
6 Comments
 
LVL 1

Expert Comment

by:patrickfreer
ID: 34233928
you could script it with the following commands - though you'd need to go through the output manually:

nslookup
set type=mx
first.domain.name
second.domain.name
etc etc

Output all this to a text file and peruse at your leisure.
0
 

Author Comment

by:myester
ID: 34234616
Thanks for the reply Patrick. Could you give me an example of how this would be done? Would I do this via a batch file?
0
 
LVL 25

Expert Comment

by:DrDave242
ID: 34234926
If you use a batch file, you have to run nslookup in non-interactive mode, like so:
nslookup -q=mx domain1.com
nslookup -q=mx domain2.com
nslookup -q=mx domain3.com

Open in new window

You can save that as a batch file, then run it from a command prompt and send the output to a text file (i. e., checkmx.bat > c:\temp\mxoutput.txt).  You'll still have to pick through that text file manually unless you can write a Perl script or something to parse it for you...and I've forgotten way too much Perl to remember how to do that without a lot of digging.  :)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Accepted Solution

by:
myester earned 0 total points
ID: 34240285
After some searching I found the following batch file information that works great:

@echo off
REM Check MX records of each domain listed in text file domainlist.txt
REM Report all MX records back into log.txt and any that contain the word
REM messagelabs into the file found.txt

set log=log.txt
del %log%

set find=messagelabs
set found=found.txt

for /f "tokens=*" %%a in ('type domainlist.txt') do (
  echo Checking "%%a."
  nslookup -type=MX %%a. 2>NUL | find "MX" >> %log%
)

start "Full list" notepad %log%

find /i "%find%" < %log% >%found%
start "Part list" notepad %found%
0
 

Author Closing Comment

by:myester
ID: 34276728
I found the solution on my own.
0
 

Expert Comment

by:Deepakanddeepak
ID: 40947406
Dear Sir,

We have no command over scripting can u please send the video for this issue. It will so helpful for me.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Most DNS problems are VERY easily troubleshot and identifiable if you can follow the steps a DNS query takes. I would like to share the step-by-step a DNS query takes from the origin to the destination. _____________________________________________…
There have been a lot of times when we have seen the need to enter a large number of DNS entries in a forward lookup zone. The standard procedure would be to launch the DNS Manager console, create the Zone and start adding new hosts using the New…
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now