How do I script a check of DNS for specific old records?

When decommissioning servers (Domain Controllers especially) there are often errand and orphaned DNS records.  This script takes a wildcard search parameter (EG below is *dc04*) and searches all zones for any trace of it, and return the results in a handy-dandy grid view, including the zone and location of the record (very handy when you’re searching dozens of zones).

You could further extend this script to clean up and remove these records, but I’ll leave that up to you.



The output looks like this (company name in the zone name and data has been obscured):


Leave a Reply

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