Reputation: 1021
I am trying to enable scavenging on a Windows Server 2022 DNS server using PowerShell. Aging at the zone level has been configured using Set-DnsServerZoneAging, but I am unable to enable scavenging at the server level using Set-DnsServerScavenging:
$timeSpan = New-TimeSpan -Days 7
Set-DnsServerScavenging `
-ScavengingState $true `
-RefreshInterval $timeSpan `
-NoRefreshInterval $timeSpan
Is it possible to enable scavenging at the server level using PowerShell as per the image below?
Upvotes: 0
Views: 1511
Reputation: 26
The checkbox you indicated is enabled via the Set-DnsServerScavenging command.
Try running it as follows:
Set-DnsServerScavenging `
-ScavengingState $true `
-RefreshInterval $timeSpan `
-NoRefreshInterval $timeSpan `
-ScavengingInterval $timeSpan
That last param is the key. If ScavengingInterval is not set, then the checkbox remains in its default state (unchecked).
Upvotes: 1