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 have a DNS server (Win 2003) which handles a few hundred domains. If one of our clients changes their domain to use DNS servers which are not ours, we still have all of the records. Is there a way of automatically pruning these domains so that they don't accumulate?

share|improve this question
up vote 2 down vote accepted

You could probably code up a script that uses the DNSCMD utility from the Windows Support Tools to enumerate all the DNS zones on your DNS server, and then check via WHOIS (or via an off-site DNS server) whether or not your server should be the authoritative DNS server. If it's not, the script could call DNSCMD to delete the offending zones.

Being somewhat of a dangerous operation, you might want to put a human in the loop (at least initially) to make sure that the script doesn't go nuts. (I'd have the script export the zone for "safe keeping" just in case before deleting it.)

share|improve this answer

Not automatically no. You'd have to use dnscmd to get a list of all your zone files then do an NS lookup on each zone. Pull out those that don't have your DNS as an authoritative server and use dnscmd to delete them.

You could script much of this, though it's the sort of thing I'd want to do manually maybe once a month.


share|improve this answer

I don't know if it is possible to enable counters for a particular zone but that would indicate which zones do not have any traffic and most likely you were removed as the nameserver for that domain.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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