Solved

How to check the mx record for multiple domains

Posted on 2010-11-29
6
3,529 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 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows 2012 Essentials - change of router 24 87
nslookup returns non-existing domain 5 56
Allow dynamic IP address to become static. 5 37
Windows DNS Zone for a Host 2 51
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. _____________________________________________…
One of the most often confused topics in the area DNS is the idea of GLUE records. Specifically, what they are, when they are needed, when they are provided, and how they are created. First, WHAT IS GLUE? To understand GLUE, you must first under…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

947 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

22 Experts available now in Live!

Get 1:1 Help Now