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.