Windows DNS servers play an essential role in Active Directory environments, allowing computers, servers, applications, and network services to locate resources by name.
As devices join and leave a network, their DNS records may remain in DNS zones long after the devices have been removed. These outdated entries are known as stale DNS records.
Over time, stale records can cause incorrect name resolution, increase DNS zone size, create unnecessary replication traffic, and make network troubleshooting more difficult.
Windows Server provides two related features to manage this problem: DNS Aging and DNS Scavenging.
Aging tracks the timestamps of dynamically registered DNS records, while scavenging identifies and removes records that have exceeded the configured aging intervals.
This guide explains how Windows DNS aging and scavenging work, how to configure them using DNS Manager and PowerShell, how to protect important records, and how to troubleshoot records that are not being deleted as expected.
Whether you administer a small Active Directory domain or a large enterprise network, understanding these settings helps maintain accurate DNS records without accidentally removing active network resources.
DNS Aging and Scavenging are Windows Server DNS features that work together to identify and remove outdated dynamic DNS records.
Consider an organization with an Active Directory domain named corp.example.com.
A laptop connects to the network and registers the following DNS record:
laptop01.corp.example.com A 192.168.10.45 Later, the laptop is removed from the organization, but its DNS record remains in the zone.
DNS clients may continue receiving the old IP address when resolving that hostname.
This is a problem because DNS does not automatically delete every record when a device disconnects.
Windows DNS solves this with two mechanisms:
DNS Aging tracks the age of eligible DNS records using timestamps. It determines when a dynamic record can be refreshed and when it becomes stale.
DNS Scavenging periodically examines eligible records and deletes those that have exceeded the configured aging periods.
Both features are required for automatic stale-record cleanup.
Aging alone does not delete records, and enabling scavenging on a DNS server does not automatically make every record eligible for deletion.
For additional DNS fundamentals, see our guides on DNS Explained and How DNS Resolution Works.
Stale DNS records accumulate when devices are removed, renamed, reconfigured, or disconnected without their DNS entries being cleaned up.
Common situations include:
For example, suppose a DHCP client originally registers:
workstation01.corp.example.com A 192.168.10.45 The device is later assigned a different IP address:
192.168.10.82 If the original DNS record remains, administrators may encounter inconsistent name resolution.
Stale records can cause several problems:
| Problem | Possible Impact |
|---|---|
| Incorrect DNS responses | Clients resolve names to outdated IP addresses. |
| Duplicate or obsolete records | Troubleshooting becomes more complicated. |
| Larger DNS zones | More records must be stored and processed. |
| Increased replication traffic | Changes and larger zone data add directory replication overhead. |
| Application connectivity problems | Services may attempt to connect to an incorrect server address. |
In an Active Directory-integrated DNS environment, DNS records are replicated through Active Directory. However, Active Directory replication does not independently determine whether a DNS record is stale.
Aging and scavenging are still necessary to identify and remove outdated records.
Although administrators often use the terms together, DNS Aging and DNS Scavenging perform different functions.
| Feature | DNS Aging | DNS Scavenging |
|---|---|---|
| Primary purpose | Tracks record timestamps and refresh eligibility | Deletes stale DNS records |
| Uses timestamps | Yes | Yes |
| Deletes records | No | Yes |
| Configuration level | DNS zone | DNS server |
| Requires the other feature | Works as part of the aging process | Requires zone Aging to be enabled |
| Main benefit | Determines record age | Removes obsolete records |
When a DNS record is registered dynamically, Windows DNS can assign a timestamp to it.
The timestamp represents the last accepted registration or refresh time.
Aging uses two intervals:
These periods determine when a record can receive a new timestamp and when it becomes eligible for scavenging.
Scavenging periodically checks DNS zones that are configured for aging.
When a record has a nonzero timestamp and has exceeded both aging intervals, it can be removed during an eligible scavenging pass.
The DNS Server service does not delete every old-looking record. It checks the record timestamp, zone configuration, server configuration, and other eligibility conditions.
This distinction is important because simply enabling automatic scavenging does not guarantee that all obsolete DNS records will disappear.
The No-Refresh and Refresh intervals are the most important settings in Windows DNS aging.
Understanding them before enabling scavenging helps prevent legitimate DNS records from being deleted.
The No-Refresh Interval is the period during which a DNS server does not update the timestamp of a record when it receives a refresh containing unchanged record data.
For example, assume a workstation registers:
PC01.corp.example.com A 192.168.10.20 The DNS server assigns a timestamp.
During the No-Refresh Interval, the workstation may send a dynamic DNS refresh that contains the same hostname and IP address.
The DNS server acknowledges the refresh but does not update the timestamp.
This reduces unnecessary timestamp changes and Active Directory replication traffic.
However, if the client updates the record data, such as registering a new IP address, the server accepts the change and resets the timestamp.
After the No-Refresh Interval expires, the Refresh Interval begins.
During this period, the DNS server accepts timestamp-only refreshes from the client.
If the client successfully refreshes its DNS record, the timestamp is updated and the No-Refresh Interval begins again.
If the client does not refresh the record before the Refresh Interval expires, the record becomes eligible for scavenging.
Windows DNS commonly uses the following default values:
| Setting | Default Value |
|---|---|
| No-Refresh Interval | 7 days |
| Refresh Interval | 7 days |
| Scavenging Period | 7 days |
The No-Refresh and Refresh intervals determine when a record becomes stale.
The Scavenging Period determines how frequently the DNS server checks for stale records.
For example:
No-Refresh Interval = 7 days
Refresh Interval = 7 days
Scavenging Period = 7 days The record becomes stale after 14 days without an accepted refresh.
It is then deleted during a subsequent eligible scavenging pass.
With these default settings, a record can remain in the zone for up to approximately 21 days after its last accepted timestamp, depending on the timing of the scavenging schedule.
Consider a record registered on Day 1.
Day 1
|
| Record registered
| Timestamp assigned
|
v
Day 1 - Day 8
|
| No-Refresh Interval
| Same-data refreshes do not update timestamp
|
v
Day 8 - Day 15
|
| Refresh Interval
| Client can refresh timestamp
|
v
After Day 15
|
| Record becomes eligible for scavenging
|
v
Next eligible scavenging pass
|
| DNS record is deleted This is a simplified example using seven-day intervals. Actual eligibility depends on the DNS server’s timestamp, zone protection time, configured intervals, and scavenging schedule.
When you first enable aging on a zone, Windows DNS gives that zone an additional protection period equal to its Refresh Interval.
This is a safety mechanism.
It allows clients to refresh records that might appear old because their timestamps were not maintained while aging was disabled.
Therefore, enabling aging does not mean that old records will immediately be deleted.
The official Microsoft explanation is available in DNS Aging and Scavenging in Windows Server.
Not all DNS records are eligible for scavenging.
Windows DNS distinguishes records using their timestamps.
Dynamic records are normally registered or updated automatically by clients, DHCP servers, or other DNS update mechanisms.
They typically have a nonzero timestamp.
Example:
| Hostname | Type | IP Address | Timestamp |
|---|---|---|---|
| PC01 | A | 192.168.10.20 | 11/20/2026 10:00 |
| PC02 | A | 192.168.10.21 | 11/24/2026 14:00 |
These records can become stale if they are not refreshed within the configured intervals.
Records created manually in DNS Manager or from a zone file normally have a timestamp of zero.
Example:
| Hostname | Type | IP Address | Timestamp |
|---|---|---|---|
| DC01 | A | 192.168.10.10 | 0 |
| FILE01 | A | 192.168.10.30 | 0 |
These records are excluded from scavenging.
This behavior protects manually maintained infrastructure records from automatic deletion.
A record with a zero timestamp can still receive a dynamic data update, but its timestamp remains zero and it stays protected from scavenging.
Critical infrastructure records may include:
Administrators should know which records are static and which are dynamically registered before enabling scavenging.
Do not assume that every record in a DNS zone is safe to remove simply because it has an old-looking IP address or hostname.
For more information about the different DNS record types, see DNS Record Types Explained.
Before enabling automatic cleanup, review the DNS environment.
DNS Scavenging is disabled by default, and an incorrect configuration can remove records that are still required.
Confirm that the Windows Server has the DNS Server role installed.
You can inspect installed DNS-related roles with PowerShell:
Get-WindowsFeature DNS The DNS management tools and the DnsServer PowerShell module must also be available.
On a remote administration workstation, install the appropriate DNS Server RSAT management tools if necessary.
List the DNS zones:
Get-DnsServerZone Identify:
Aging and scavenging apply to standard primary and Active Directory-integrated zones.
Secondary and stub zones do not support these processes.
Inspect a zone’s properties in DNS Manager.
For domain-joined Windows clients, secure dynamic updates are generally the preferred configuration for Active Directory-integrated zones.
Confirm that the intended clients and DHCP infrastructure can register and refresh their records correctly.
Aging cannot compensate for broken dynamic DNS registration.
If DHCP assigns addresses to clients, examine the lease duration and client registration behavior.
The combined No-Refresh and Refresh intervals must allow clients enough time to renew their DNS registrations.
If the intervals are too short, a device that is temporarily disconnected or has an extended lease may have its DNS record removed while it is still valid.
Do not copy another organization’s interval settings without considering your own DHCP lease policies, device behavior, and registration schedule.
For Active Directory-integrated DNS zones, verify directory replication before changing scavenging settings.
Useful commands include:
repadmin /replsummary And:
repadmin /showrepl If replication is unhealthy, resolve the existing problems before introducing DNS cleanup changes.
Also ensure that DNS servers have reliable time synchronization. Aging calculations depend on the current time of the DNS server.
Before enabling scavenging in production, export the relevant zone data.
For example:
Export-DnsServerZone `
-Name "corp.example.com" `
-FileName "corp-example-before-scavenging.dns" The export file is created in the DNS Server’s default DNS directory unless a different supported file location is specified.
For Active Directory-integrated zones, this export is useful for troubleshooting and record review. It is not a replacement for a supported Active Directory or system-state backup.
Make sure that you have a suitable recovery plan before enabling automatic deletion.
DNS Manager provides a graphical interface for configuring aging and scavenging.
The following example uses:
DNS Server: DNS01
Domain: corp.example.com Replace these values with your actual environment.
On the DNS server or an administrator workstation with DNS tools installed:
You can also open the console directly:
dnsmgmt.msc In DNS Manager:
corp.example.com.Select the Aging tab.
Enable:
Scavenge stale resource records Configure the following values:
No-refresh interval: 7 days
Refresh interval: 7 days These are the standard default values and are suitable as a starting point for many environments.
However, verify that they match the expected dynamic DNS refresh behavior of your clients.
Click Apply or OK to save the settings.
The Aging setting applies to the selected DNS zone.
For an Active Directory-integrated zone, the zone-level aging configuration replicates with the zone data to DNS servers that host that zone.
For a non-AD-integrated zone, configure the relevant zone on its primary DNS server.
Do not confuse this zone-level configuration with enabling automatic scavenging on the DNS server itself.
Both are required.
After configuring aging on the zone, enable automatic scavenging on the DNS server.
In DNS Manager:
Select:
Enable automatic scavenging of stale records Configure the Scavenging Period.
A common starting value is:
Scavenging period: 7 days Click OK.
The Scavenging Period controls how frequently the DNS server performs a scavenging pass.
It does not determine when a record becomes stale. That is determined by the record timestamp and the No-Refresh and Refresh intervals.
Avoid enabling aging across every DNS zone without first reviewing the record contents and zone types.
DNS Manager provides an option to set aging and scavenging for all zones.
If you use this option, carefully review the setting that applies it to existing Active Directory-integrated zones.
Applying settings broadly can affect existing records and zones that were not previously configured for aging.
For production environments, a controlled zone-by-zone configuration is easier to audit.
PowerShell provides more control over DNS aging and scavenging.
The examples below use the Windows DNS Server PowerShell module.
Open an elevated PowerShell session on the DNS server or an administrator workstation with the module installed.
Import the module:
Import-Module DnsServer Run:
Get-DnsServerScavenging This displays the server’s scavenging configuration.
Review:
Run:
Get-DnsServerZoneAging -Name "corp.example.com" This displays the aging configuration for the specified zone.
Confirm whether aging is enabled and review both intervals.
To enable aging on corp.example.com with seven-day intervals:
Set-DnsServerZoneAging `
-Name "corp.example.com" `
-Aging $true `
-NoRefreshInterval 7.00:00:00 `
-RefreshInterval 7.00:00:00 The TimeSpan format is:
Days.Hours:Minutes:Seconds Therefore:
7.00:00:00 represents seven days.
Run:
Set-DnsServerScavenging `
-ScavengingState $true `
-ScavengingInterval 7.00:00:00 This enables server-level scavenging and sets the automatic scavenging period to seven days.
The server-level setting does not replicate through Active Directory.
Configure it separately on every DNS server that you intend to use for scavenging.
In an environment with multiple DNS servers hosting the same zone, it is often easier to designate one server to perform scavenging.
For example:
Set-DnsServerZoneAging `
-Name "corp.example.com" `
-Aging $true `
-ScavengeServers 192.0.2.10 Replace 192.0.2.10 with the IP address of the DNS server authorized to scavenge that zone.
This restriction helps make cleanup activity easier to monitor and troubleshoot.
By default, all DNS servers hosting a zone may be authorized to scavenge it. A deliberate single-server design can reduce coordination issues.
Run:
Get-DnsServerScavenging Then:
Get-DnsServerZoneAging -Name "corp.example.com" Check that both server-level scavenging and zone-level aging are configured as intended.
For other DNS servers, repeat the server-level check and configuration where required.
Microsoft’s official reference includes the Set-DnsServerZoneAging and Set-DnsServerScavenging cmdlets.
One of the most important parts of DNS scavenging is protecting records that must remain available.
A record with a zero timestamp is not eligible for scavenging.
To protect an existing record:
Delete this record when it becomes stale Clearing this option sets the record timestamp to zero.
The record is then excluded from scavenging.
Remember that this protects the record from automatic aging and scavenging. It does not prevent an administrator or an authorized update process from deleting or modifying the record.
When you create an A record without the -AgeRecord parameter, it receives a zero timestamp and is protected from scavenging.
Example:
Add-DnsServerResourceRecordA `
-ZoneName "corp.example.com" `
-Name "criticalhost" `
-IPv4Address "192.0.2.50" The record is created without a dynamic aging timestamp.
By contrast, including -AgeRecord assigns a timestamp:
Add-DnsServerResourceRecordA `
-ZoneName "corp.example.com" `
-Name "testhost" `
-IPv4Address "192.0.2.60" `
-AgeRecord This makes the record eligible for aging and, eventually, scavenging if it is not refreshed.
Do not assume that a single PowerShell command can clear the timestamp of any existing resource record.
Microsoft documents that there is no dedicated cmdlet that simply clears the timestamp of an existing record.
One supported approach is to remove the existing record and re-create it as a static record without -AgeRecord.
However, this temporarily removes the DNS name and changes the record’s ownership and permissions.
In environments using secure dynamic updates, those changes can affect later client registration.
Before doing this, capture the existing record data and understand the security and registration implications.
For most administrators, using the DNS Manager record properties to protect an existing record is easier to review.
Use:
Get-DnsServerResourceRecord `
-ZoneName "corp.example.com" To display the most relevant properties:
Get-DnsServerResourceRecord `
-ZoneName "corp.example.com" |
Select-Object HostName, RecordType, Timestamp, RecordData Review the Timestamp field.
A zero or empty timestamp indicates that the record is static and excluded from scavenging.
A nonzero timestamp indicates that the record can be considered for aging, subject to the other zone and server settings.
Important: Never run dnscmd /ageallrecords as a general cleanup shortcut. It assigns timestamps to records across the zone, including manually created records that may need to remain protected.
Sometimes administrators enable aging and scavenging but notice that old records are not deleted.
In other situations, legitimate DNS records disappear unexpectedly.
Both cases require checking the full configuration rather than repeatedly running scavenging commands.
Check whether scavenging is enabled on the DNS server:
Get-DnsServerScavenging Check whether aging is enabled on the relevant zone:
Get-DnsServerZoneAging -Name "corp.example.com" Then inspect record timestamps:
Get-DnsServerResourceRecord `
-ZoneName "corp.example.com" |
Select-Object HostName, RecordType, Timestamp Potential causes include:
Also remember the additional protection interval applied when aging is first enabled or its settings are changed.
If valid records are deleted, review the configured intervals first.
For example, consider:
No-Refresh Interval = 1 day
Refresh Interval = 1 day These settings may be too short for clients that do not refresh DNS frequently.
A device can still be active while its timestamp becomes old enough to qualify for scavenging.
Review:
Do not immediately assume that scavenging itself is malfunctioning. The intervals may not match the environment’s registration behavior.
Check the server-level scavenging configuration on every DNS server.
Remember:
If you want only DNS01 to scavenge corp.example.com, verify that the zone’s ScavengeServers setting allows DNS01.
Also confirm that DNS01 hosts the zone and has healthy DNS service operation.
An old timestamp alone is not enough to prove that the record should already have been deleted.
The server evaluates:
Record Timestamp
+ No-Refresh Interval
+ Refresh Interval
< Current Server Time The record must also pass the zone and server eligibility checks.
After becoming stale, it remains in the zone until the next eligible scavenging pass.
Check Active Directory replication:
repadmin /replsummary And:
repadmin /showrepl Then inspect the DNS Server and Directory Service event logs.
An AD-integrated zone that has not loaded or received the required directory updates may be skipped by the scavenging process.
Do not force cleanup until the zone and replication state are understood.
For related troubleshooting, see Active Directory Replication Troubleshooting.
Windows DNS records scavenging activity in the DNS Server event logs.
This makes Event Viewer an important tool for confirming that automatic cleanup is working.
Review the events related to scavenging and zone loading.
| Event ID | Meaning |
|---|---|
| 2501 | A scavenging pass ran and removed records. |
| 2502 | A scavenging pass ran but did not remove any records. |
| 4013 | DNS is waiting for Active Directory Domain Services initialization before loading AD-integrated zones. |
| 4515 | A duplicate DNS zone was detected in Active Directory. |
| 4521 | An AD-integrated zone could not be loaded. |
Event 2501 is particularly useful because it indicates that records were scavenged.
Review its details to identify which records were removed.
Event 2502 is not necessarily an error. It can indicate that a scavenging pass completed successfully but no records were eligible for deletion.
Events 4013, 4515, and 4521 are useful when investigating problems with Active Directory-integrated zones.
For these events, also inspect Active Directory replication and the Directory Service event log.
The scavenging server schedules subsequent automatic passes according to the configured Scavenging Period.
For example, with a seven-day period:
Scavenging Period = 7 days You can use the most recent 2501 or 2502 event as an approximate reference for monitoring the schedule.
The event timestamp represents the completion time of the pass, so it is not an exact record of the next pass’s start time.
Microsoft documents these events and scheduling behavior in its DNS Aging and Scavenging Configuration Guide.
Several configuration mistakes can cause unexpected DNS behavior.
Enabling scavenging without enabling zone aging. Server-level scavenging alone does not make records in an unconfigured zone eligible for removal.
Setting intervals too short. Clients that are temporarily offline or use longer registration cycles may lose valid records.
Assuming static records will be deleted. Static records with zero timestamps are intentionally excluded from scavenging.
Applying aging to every zone without reviewing records. Broad configuration changes can affect zones with different operational requirements.
Running multiple scavenging servers without coordination. Multiple independently scavenging servers can make cleanup behavior more difficult to monitor and troubleshoot.
Using dnscmd /ageallrecords indiscriminately. This can assign timestamps to important static records and make them eligible for deletion.
Ignoring DHCP registration behavior. DHCP lease policies and DNS registration schedules must be considered when selecting aging intervals.
Confusing the Scavenging Period with record age. The scavenging period controls how frequently the server checks records, not how long a record must remain inactive before becoming stale.
Ignoring Active Directory replication. In AD-integrated zones, replication health affects whether DNS updates and scavenged deletions propagate correctly.
Consider an organization with the following DNS infrastructure:
| Component | Configuration |
|---|---|
| Domain | corp.example.com |
| DNS Server | DNS01 |
| DNS Server IP | 192.168.10.10 |
| Zone Type | Active Directory-integrated |
| No-Refresh Interval | 7 days |
| Refresh Interval | 7 days |
| Scavenging Period | 7 days |
The goal is to enable automatic cleanup of stale dynamic records without deleting manually maintained infrastructure records.
Get-DnsServerScavenging -ComputerName "DNS01" Get-DnsServerZoneAging `
-Name "corp.example.com" `
-ComputerName "DNS01" Export-DnsServerZone `
-ComputerName "DNS01" `
-Name "corp.example.com" `
-FileName "corp-example-before-scavenging.dns" Remember that this export is a troubleshooting copy, not a replacement for a proper Active Directory backup.
Set-DnsServerZoneAging `
-ComputerName "DNS01" `
-Name "corp.example.com" `
-Aging $true `
-NoRefreshInterval 7.00:00:00 `
-RefreshInterval 7.00:00:00 `
-ScavengeServers 192.168.10.10 Set-DnsServerScavenging `
-ComputerName "DNS01" `
-ScavengingState $true `
-ScavengingInterval 7.00:00:00 Get-DnsServerResourceRecord `
-ComputerName "DNS01" `
-ZoneName "corp.example.com" |
Select-Object HostName, RecordType, Timestamp, RecordData Identify important records that must remain static and verify their timestamps.
Get-DnsServerScavenging -ComputerName "DNS01" Get-DnsServerZoneAging `
-Name "corp.example.com" `
-ComputerName "DNS01" Check the DNS Server event log for Event IDs 2501 and 2502 after scavenging passes occur.
Do not expect all old-looking records to disappear immediately after enabling aging. The initial zone protection period and the No-Refresh and Refresh intervals must be respected.
DNS Server role is installed and operating correctly.
The target zone is a supported primary or AD-integrated zone.
Active Directory replication is healthy where applicable.
DNS dynamic registration is working as expected.
DHCP lease and registration policies have been reviewed.
Important static records have been identified.
DNS zone data has been exported and a recovery plan exists.
Zone-level aging is enabled.
No-Refresh and Refresh intervals match the environment.
Server-level scavenging is enabled on the intended DNS server.
ScavengeServers restrictions are configured where appropriate.
Record timestamps have been reviewed.
Event IDs 2501 and 2502 are monitored.
Windows DNS Aging and Scavenging help administrators maintain clean and accurate DNS zones by identifying and removing obsolete dynamic resource records.
Aging tracks record timestamps and controls refresh eligibility through the No-Refresh and Refresh intervals. Scavenging periodically examines eligible zones and removes records that have exceeded those intervals.
The most important part of deploying this feature is understanding the difference between server-level scavenging and zone-level aging, reviewing dynamic DNS registration behavior, and protecting important static records.
Start with a backup and an inventory of your DNS zones. Configure aging for the intended zones, enable scavenging on the selected DNS server, and monitor the DNS Server event log to confirm that cleanup behaves as expected.
When configured carefully, DNS scavenging reduces stale records, improves DNS administration, and helps maintain reliable name resolution across Windows Server and Active Directory environments.
Introduction Border Gateway Protocol (BGP) is the routing protocol used to exchange network reachability information…
Introduction A Linux server can experience connection failures even when its network interface is working…
Introduction TCP retransmissions are an important indicator of network reliability and performance. When a Linux…
Open Shortest Path First (OSPF) is a link-state routing protocol widely used in enterprise networks…
Group Policy is one of the most important management features in Windows Server Active Directory…
Linux services are responsible for running many of the critical components that keep a server…