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
Solved

How to check the mx record for multiple domains

Posted on 2010-11-29
6
3,689 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
LINUX, CPANEL & WHM 5 56
DNS error assumed 8 71
options for ipv4 failover 2 31
HP MSM720 Controller - Issue using 3rd party wildcard certificate for HTML Authentication 2 35
BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (https://kb.isc.org/article/AA-01272), affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
Resolve DNS query failed errors for Exchange
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 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