dns zone scavenging issue

Aisyah 5 Reputation points
2026-08-19T04:35:22.11+00:00

I want to enable dns zone scavenging, but every time i do, some critical static server records are deleted because they were mistakenly flagged as dynamic. please tell me how to identify non‑stale records and convert dynamic ones back to static using powershell. Thank in advance

Windows for business | Windows 365 Business
0 comments No comments

1 answer

Sort by: Most helpful
  1. Hoang Le 1,285 Reputation points Independent Advisor
    2026-08-19T09:48:28.02+00:00

    Hello,

    When DNS scavenging deletes records you want to keep, it usually means those records were created as dynamic entries but should have been static. Scavenging only targets dynamic records with timestamps, so the key is to identify which records have a Timestamp attribute and then convert them to static so they are no longer flagged.

    You can do this directly in PowerShell. First, query the zone for records that are dynamic:

    powershell

    Get-DnsServerResourceRecord -ZoneName "yourzone.local" | Where-Object { $_.Timestamp -ne $null }

    Any record returned here has a timestamp and is therefore considered dynamic. Static records will show Timestamp as blank. Once you identify the critical records that should not be scavenged, you can re‑create them as static. PowerShell does not allow you to simply flip a dynamic record to static; you need to delete and re‑add it without a timestamp. For example, if you have a host record:

    powershell

    Remove the dynamic record

    Remove-DnsServerResourceRecord -ZoneName "yourzone.local" -Name "server01" -RRType "A" -Force

    Recreate as static

    Add-DnsServerResourceRecordA -ZoneName "yourzone.local" -Name "server01" -IPv4Address "192.168.1.10"

    The new record will be static and immune to scavenging. If you want to automate the conversion, you can export all dynamic records, filter out the ones you want to preserve, and then re‑add them as static using the corresponding Add-DnsServerResourceRecord* cmdlets for A, CNAME, MX, etc.

    One important note: before enabling scavenging globally, make sure you have reviewed all dynamic records in the zone. Often DHCP‑registered client records should remain dynamic, but servers, domain controllers, and infrastructure devices should always be static. A best practice is to manually re‑add those infrastructure records as static before turning on scavenging.

    I hope you've found something useful here. If it helps you get more insight into the issue, it's appreciated to accept the answer. Should you have more questions, feel free to leave a message. Have a nice day!

    HL.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.