Enabling DNS Scavenging on AD-Integrated Zones Deletes Records for Hosts That Never Re-register
Overview
A tidy-up of stale DNS records goes quiet for weeks, then names start vanishing from every domain controller. The cause is the timestamp.
At a glance
- Symptom
- A tidy-up ticket asks for stale records to be cleaned from the contoso.com zone.
- Likely cause
- A record is scavenged only when all four conditions hold: scavenging is enabled on the server, aging is enabled on the zone, the record…
- Impact
- Names of hosts that do not refresh stop resolving on every DNS server that hosts the zone once replication catches up, usually in a pattern that follows who…
- Verification signal
- The timestamp listing should show no record older than the combined intervals that you cannot explain, and every protected record should show a zero or empty timestamp.
- Safe correction
- The order matters more than the commands.
- Rollback or recovery
- Each step above has its own way back, listed here in the order you would need them.
Turning on DNS aging and scavenging can delete A records that your servers still need, and it does so no sooner than about one refresh interval (seven days by default) after the change, so nothing looks wrong on the day. Any record that was registered dynamically but is never refreshed has a nonzero timestamp, goes stale, and is removed by the first scavenging pass after the zone’s grace period. On an AD-integrated zone that deletion replicates to every DNS server.
Find unrefreshed records before you enable scavenging, protect the ones that must stay, and let one server scavenge.
Symptom
A tidy-up ticket asks for stale records to be cleaned from the contoso.com zone. Someone enables scavenging at the server and applies it to all zones. The change passes review, nothing happens that afternoon, and the ticket is closed.
Some days later a file server, a print appliance or an application host stops resolving. The host is up and its IP address has not changed, but its name returns no answer from any domain controller. Re-creating the record by hand fixes it, which makes the cause look like a one-off. A week later another name goes the same way.
Why the change looks safe
Scavenging has a reputation for being cautious. Aging and scavenging are off by default, the documented defaults are seven days each, and nothing is deleted when you apply the setting. Static records, which people think of as the important ones, are exempt. It is easy to assume that anything that matters is static, and that only abandoned machines have dynamic records.
Root cause
A record is scavenged only when all four conditions hold: scavenging is enabled on the server, aging is enabled on the zone, the record has a nonzero timestamp, and its timestamp plus the no-refresh interval plus the refresh interval is earlier than the server time. Records added by dynamic update get a timestamp automatically. Records added by hand have a timestamp of zero and are skipped.
The trap is the middle group. A host that registered itself once, and now has a fixed address or a client that does not re-register, still has a dynamic record with a timestamp. Windows clients refresh every 24 hours, so they stay fresh. A host that never refreshes does not, and with the defaults it becomes stale after 14 days and is deleted at the next pass, up to 21 days in the worst case.
Two further details hide the delay. When you enable aging on a zone, the zone is given one refresh interval of protection before it can be scavenged.
Also, Set-DnsServerScavenging -ApplyOnAllZones is the documented way to age records in zones that already exist, so one command reaches every zone. In an AD-integrated zone the server writes the deletion to Active Directory, which replicates it to the other DNS servers hosting the zone, so no other server keeps a copy you can fall back to.
Impact
Names of hosts that do not refresh stop resolving on every DNS server that hosts the zone once replication catches up, usually in a pattern that follows who registered them: appliances, servers with fixed addresses, and anything whose dynamic registration is blocked or switched off.
If the last record under a name goes, the node is tombstoned and the name disappears. Because the deletion is spread over a scavenging period, outages arrive one at a time, long after the change, which makes them hard to tie back to it.
How to confirm it
All of these checks are read-only. Run them in an elevated session on a DNS server.
- Read the server and zone settings with
Get-DnsServerScavengingandGet-DnsServerZoneAging -Name "contoso.com". Note the intervals, whether aging is on, and which servers may scavenge. - List records that carry a timestamp, oldest first, with
Get-DnsServerResourceRecord -ZoneName "contoso.com" -RRType A | Where-Object { $_.Timestamp } | Sort-Object Timestamp | Select-Object HostName,Timestamp,RecordData. A static record shows a zero or empty timestamp and is left out. - Look at the DNS Server event log. Event 2501 means a pass ran and records were scavenged, and 2502 means a pass ran and none were.
Following along? Tap a step’s number to tick it off.
Any record whose timestamp is older than the no-refresh plus refresh interval is on the list for deletion. Microsoft’s own procedure treats such records as a problem with dynamic registration to explain before scavenging is enabled. Related reading on the dynamic-update side of the same zones: Allowing Nonsecure Dynamic Updates Lets Any Host Hijack an AD-Integrated DNS Zone.
The tempting shortcut
Once you see old timestamps, the quick fix is to run dnscmd /ageallrecords on the zone so everything looks fresh. It stamps the current time on every record, including the static ones you wanted protected. Microsoft documents that a timestamp added this way cannot be reversed.
It also leaves the cause alone, because the host still does not refresh. A shorter refresh interval is no better: if it is shorter than the time clients need to re-register, scavenging deletes legitimate records.
Correction
The order matters more than the commands. Each state change below needs a backup and a way back, and you should test it in a lab first.
- Back up the zone. Run
Export-DnsServerZone -Name "contoso.com" -FileName "contoso.com.backup". The file goes toC:\Windows\System32\dnsby default. - Pick one scavenging server. Run
Set-DnsServerZoneAging -Name "contoso.com" -Aging $true -ScavengeServers 192.0.2.10with the address of that server, and leave server-level scavenging off everywhere for now. The one-refresh-interval grace period starts here. - Wait, then look. After the no-refresh and refresh intervals have passed, repeat the timestamp listing. Explain every old record: run
ipconfig /registerdnson the host, check the record’s owner, and check that AD replication is healthy. - Protect what must stay. For a record that has to survive, remove the dynamic record and add it again as static with
Add-DnsServerResourceRecordA -ZoneName "contoso.com" -Name "criticalhost" -IPv4Address "192.0.2.50", leaving out-AgeRecord. Capture the record’s data first, because this changes its ownership and permissions and can affect later dynamic registration by the client. - Enable scavenging on that one server only. Run
Set-DnsServerScavenging -ScavengingState $true -ScavengingInterval 7.00:00:00without-ApplyOnAllZones.
Validation
The timestamp listing should show no record older than the combined intervals that you cannot explain, and every protected record should show a zero or empty timestamp. After the first pass, event 2501 or 2502 should appear on the scavenging server and on no other.
Create a test record with Add-DnsServerResourceRecordA and -AgeRecord so that it carries a timestamp, work out when it becomes eligible by adding the refresh and no-refresh intervals, and confirm it disappears at the predicted pass and that nothing else does.
Do not use Start-DnsServerScavenging as a trial: it is not a dry run, and it deletes.
Rollback
Each step above has its own way back, listed here in the order you would need them.
- Backup: delete the exported file when you no longer need it. Nothing else changes.
- Zone aging: run
Set-DnsServerZoneAging -Name "contoso.com" -Aging $false. Scavenging then skips the zone. - Static record: delete the record you added in DNS Manager and restore the dynamic registration with
ipconfig /registerdnson the host. - Server scavenging: run
Set-DnsServerScavenging -ScavengingState $falseon the server you changed. - Deleted records: recreate each one as a static record from the exported zone file. A scavenged deletion has already replicated, so the zone export you took first is the practical source.
Stop it happening on the next zone
Treat scavenging as a change with a delayed effect. Do the timestamp check first, enable it on one server, and align the combined intervals with your DHCP lease duration. Create servers, printers and other long-lived records as static from the start. Watch event 2501 after every pass, and review other zone settings that outlast a change, such as legacy zone transfer flags that survive Windows DNS upgrades.
Check version-specific behaviour on Microsoft’s DNS aging and scavenging page.
Apply the safer control
Before you change production
Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.
Fix commands and configuration
contoso.comSet-DnsServerScavenging -ApplyOnAllZonesGet-DnsServerScavengingWhen to escalate
Validation and rollback are covered in the sections above.
Escalate
Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.
Fixed? Get the next one before it hits you: The KBY Brief
Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.
About this page
Credited to
Dates
Published
Corrections
No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Found this useful? Follow KBY for more like it.

