Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm about to switch a mail server. I'd like to be able to search Microsoft DNS where

MX Server == ''

Or, perhaps == 'mail' OR CNAME.value == ''

Does anyone know of a tool that will permit to accomplish something like this?

share|improve this question

closed as unclear what you're asking by Ward, kasperd, mdpc, Jenny D, Tom O'Connor Apr 20 '15 at 11:58

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

It is very hard to understand what it is you're asking. My instinct says you're looking for something like nslookup -type=MX – Jeff Ferland Feb 21 '12 at 16:57
No. I have a Microsoft DNS server, it has 150,000 domains. I want to find domains that have the MX server already set to so I know what the change I want to make will effect. – Evan Carroll Feb 21 '12 at 17:15
Anything wrong with a perl / python / ruby / whatever script that looks up the MX record for all 150,000 domains? That's the simplest method as far as human time is concerned. – Jeff Ferland Feb 21 '12 at 18:35
How would I get the list of domains the DNS server provides, in the end grepping through the folder as mentioned in my answer was by far the best solution for me. – Evan Carroll Feb 21 '12 at 18:53
If you don't know the list of domain you're authoritative for, then yes I'd get grepping. – Jeff Ferland Feb 21 '12 at 19:11

Here are a few ideas:

  • If you're using zone files to store the zones (i.e. not Active Directory integrated zones) then you can just use find, findstr, or your favorite grep port to search the zone files (stored in %SystemRoot%\system32\dns by default).

  • You could use nslookup or dig and perform queries against the DNS server

  • You can use the command-line dnscmd tool to dump zones and search them with find, findstr, grep, etc.

  • You could sort the columns in the DNS management console snap-in to cause the data you're looking for to appear in a known location

I'm not exactly sure I understand what you're looking for, but I'd lean toward the first two ideas as being the best ways. I do find myself, from time to time, sorting the columns in the DNS management console to quickly see if I've created a given record.


150,000 domains. Zow.

You could probably hack the script in this answer I wrote to loop thru your zones looking for the records you want. It shouldn't be too bad.

share|improve this answer
Where do I get dnscmd, for Windows Server 2008? – Evan Carroll Feb 21 '12 at 18:02
It's part of the Windows Support Tools. They're in the "SUPPORT\TOOLS" folder on the installation media. – Evan Anderson Feb 21 '12 at 18:07
gha. I don't have the installation media it's on a cloud server. – Evan Carroll Feb 21 '12 at 18:14
Download an evaluation version of Windows Server 2008 R2, if nothing else. – Evan Anderson Feb 21 '12 at 18:14
@EvanCarroll: If the zones are stored in files then grepping them is fine. Active Directory integrated zones won't be stored in files. – Evan Anderson Feb 22 '12 at 17:45

Okay, so this is probably going off the reservation as far as the "official method" but this is what I've always done. As long as the zone files are being stored on disk (external domains, not AD), you can use the following Powershell script to search the text zone files for specific IP addresses/host names/record types.

Param ([String]$searchPattern)

      $resultsFormat = @{Expression={$_.Filename};Label="File"},

      $searchResults = Get-ChildItem -Filter "*.dns" | Select-String -Pattern $searchPattern | ft $resultsFormat -AutoSize

If ($searchResults) {$searchResults} Else {Write-Host "`nNo search results`n"}

Save this script to the "C:\Windows\System32\DNS" folder and name it "query.ps1". Then run it from Powershell by changing to that directory and typing "query.ps1 ".

I share this folder on all my DNS servers (for admins only) and then map a drive to it. This way I can run the script from my workstation by executing it from the mapped drive. Easy Peasy.


Find all the DNS entries with "" in them


Find all the DNS entries with "www" in them

.\query.ps1 www

Find all the DNS entries with "mx" in them

.\query.ps1 mx
share|improve this answer


    set type=mx

when you press enter, the dns will resolve all the mail type records regarding that specific domain.

share|improve this answer
but, I want to query the local DNS server for where the mail record equals something -- I do not want to dump the MX record for a single domain. – Evan Carroll Feb 21 '12 at 17:13

Searching for DNS entries in the GUI, where you would expect to search, if using the GUI to create entries is not possible because, surprisingly, Microsoft did not include in the DNS GUI which is why you need to revert to using a command or script.

share|improve this answer
A more specific answer may be helpful, otherwise you might consider leaving a comment instead. – Drew Khoury Jan 13 '15 at 12:03
up vote -5 down vote accepted
  1. Install cygwin.
  2. Browse to C:\Windows\System32\dns
  3. Use grep.

Like any Microsoft Problem, it's most easily solved with the Cygwin port of the Linux toolset.

share|improve this answer
FYI, Windows has a built-in "find" command to... well... find text inside files. Or you can use PowerShell to do even better searching. – Massimo May 9 '14 at 1:42
This is a terrible solution as you can easily solve it in Powershell, and as such it doesn't really deserve to be accepted. – Jacob May 9 '14 at 11:52
This folder doesn't seem to contain the complete set of DNS entries served by my server anyway (2012 R2). It's mostly just a log file. – Rup Apr 1 at 11:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.