Solved

How to check the mx record for multiple domains

Posted on 2010-11-29
6
3,759 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 26

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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Occasionally you run into the website or two that will not resolve properly using your own DNS servers.  Some people simply set up global forwarders for their DNS server.  I don’t recommend doing this because it can cause problems resolving addresse…
I've written instructions for one router type, but this principle may be useful for others of the same brand and even other brands of router. Problem: I had an issue especially with mobile devices that refused to use DNS information supplied via…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

740 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