Is there a way to search the entire forward lookup zone in Windows 2008 R2 DNS server?
I would like to search both the
NAME and the
RDATA of all the resource records for a substring.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
You can use
dnscmd to enumerate records in a zone.
dnscmd /enumrecords mydomain.com @
You can then search the output of that for your string(s).
dnscmd /enumrecords mydomain.com @ | find "somestring"
or dump it to a file and parse the file with whatever tool you like
dnscmd /enumrecords mydomain.com @ > mydomain_enum.txt
There's a good article on doing something similar here.
And, as voretaq points out, yes it does work with non-AD-integrated zones.
For an AD-Integrated zone you should be able to do this via an LDAP search.
I'm not sure about the LDAP schema MS uses, but it's going to involve a filter something like
(|(name=???)(rrdata=???)) -- I'm almost certain they don't use
rrdata but substitute appropriately.
For non-integrated zones it may be easier to dump the zone file in BIND format and grep through it, or trigger an AXFR and grep through that. I'm not aware of anything in the Windows tools that lets you do a substring search.
Of course the last time I touched Windows DNS tools Win2K was The New Hotness On The Block so my knowledge is a little stale…