Example:
- I have a server named server1.domain.local
- I have lots of CNAME entries in various forward lookup zones pointed to server1.domain.local
- I want to decomission server1, and have a new server, server2, that is going to replace it.
I need to change all of my CNAMEs that point to server1.domain.local to point to server2.domain.local.
I know I can create server1.domain.local as another CNAME, but I would prefer to just find all the entries and change them individually.
How can I go about finding all references in all forward lookup zones to server.domain.local?
The
dnscmd
utility from the Windows Support Tools is probably your best bet. You can get a list of all the DNS zones with the command:dnscmd [servername] /EnumZones
. You can enumerate all the CNAME records in each zone with the command:dnscmd [servername] /EnumRecords [zone name] . /TYPE CNAME
.In theory you could chain these two together in a script, process the output, and make the changes you want automatically (also using
dnscmd
with the/RecordDelete
and/RecordAdd
commands). That's an exercise I'll leave to you (for now).Edit: Okay-- I couldn't resist. Here's that script. It will only
echo
the commands that actually make changes. If it does what you want then you can pull theecho
commands out and let 'er rip.One method would be to run
nslookup
from one of your DNS servers, or a system that is permitted to perform a zone transfer. Withnslookup
do als > file
which will request a copy of the zone database and save it to a text file. Then the search feature in your favorite text editor to find things to fix.Are these AD integrated zones? If not, you can manually edit the zone files with notepad (find and replace) and then reload the zones.
EDIT
My bad. I didn't see in your title that these are AD integrated zones. You can still use the method I posted by changing the zones to non-AD integrated zones, editing the zone files that will be created, then changing them back to AD integrated zones. It's a bit of a hack so this may not be the method you'd prefer to use.