Check MX Record in Windows from Command Line

I don’t know how many times a day/week I do this to troubleshoot various issues with email systems. Good command in general to remember and use.
It’s really easy to use nslookup to lookup MX records for a domain.

nslookup -type=mx google.com
C:>nslookup -type=mx google.com
Server:  ns1.domain.local
Address:  10.147.204.18
Non-authoritative answer:
google.com      MX preference = 10, mail exchanger = aspmx.l.google.com
google.com      MX preference = 30, mail exchanger = alt2.aspmx.l.google.com
google.com      MX preference = 40, mail exchanger = alt3.aspmx.l.google.com
google.com      MX preference = 50, mail exchanger = alt4.aspmx.l.google.com
google.com      MX preference = 20, mail exchanger = alt1.aspmx.l.google.com

You can see that the server used to query is ns1.domain.local.  The key here is “-type=mx”.  There are many other options you can use in place of “mx”.  Take a look at nslookup /? for additional options!
You can expand this further and resolve the returned MX records to IP address:

nslookup aspmx.l.google.com
C:>nslookup aspmx.l.google.com
Server:  ns1.domain.local
Address:  10.147.204.18
Non-authoritative answer:
Name:    aspmx.l.google.com
Addresses:  2607:f8b0:4001:c02::1b
          74.125.133.26

You can see that this has both an ipv4 and ipv6 resolved address.

Published by

Rich

Just another IT guy.

Leave a Reply

Your email address will not be published. Required fields are marked *