Ritmo2k
Ritmo2k

Reputation: 1021

Enabling DNS server scavenging using PowerShell

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?

enter image description here

Upvotes: 0

Views: 1511

Answers (1)

Robert Marzett
Robert Marzett

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

Related Questions