Practice
A common occurrence in a Windows domain is that computers joining the network automatically register their A records (and, when possible, PTR records) on the DNS servers (which, as a rule, also double as domain controllers). This makes it easy to find a computer by its name regardless of which subnet that computer is on.
As long as the given computer is on the network and keeps its record up to date, everything is fine. But then you rename its hostname, reinstall the OS on it, or simply decommission a piece of hardware that has served its time. What happens? The DNS record for that computer name remains registered on the DNS server.
Moreover, even if another computer appears with the same IP address, it won't notice that some other A record also points to its IP (it just won't be able to create a PTR record, but this usually bothers neither the operating system nor the administrator).
How do you deal with this? Relatively simply - you can set an interval after which stale, unrefreshed records on the Windows DNS server will simply be deleted. This way old, no-longer-valid entries get cleaned up.
Of course, this will take some time (which you specify yourself). That is, a record won't disappear automatically the moment you do something with the computer - the aging period you specified will have to pass before the DNS server realizes that a computer with that name no longer exists.
So, let's set this option for Windows Server DNS servers.
1) Open the DNS server snap-in
Start -> Administrative Tools -> DNS
2) Select the required server (by default, only the local server is present in the list)
3) Right-click this server and select "Properties"
4) Go to the "Advanced" tab
5) Enable the option "Enable automatic scavenging of stale records"
6) Set the "Scavenging period".
Note. The default value of "7 days" is quite small. I settle on a value of 30 to 45 days.
7) Click "OK". That's all.
Now, once the specified period of time has elapsed, if a zone has not been refreshed, it will be automatically deleted from the DNS server. Since Windows computers periodically poke the DNS server and refresh their zones, active records will keep living, while stale ones will be deleted.
Comments