Script to check DNS records that are eligible for scavenging

The following is a script leveraging PowerShell and WMI to check DNS entries that are eligible for DNS scavenging:

$TotalAgingInterval = 10 #No-Refresh period + Refresh period (in Days)
$ServerName = "<ServerName>"
$ContainerName = "<DNSZone>"

$MinTimeStamp = [Int](New-TimeSpan -Start $(Get-Date("01/01/1601 00:00")) -End $((Get-Date).AddDays(-$TotalAgingInterval))).TotalHours
Get-WMIObject -Computer $ServerName -Namespace "root\MicrosoftDNS" -Class "MicrosoftDNS_AType" -Filter "ContainerName='$ContainerName' AND TimeStamp<$MinTimeStamp AND TimeStamp<>0" | Select-Object OwnerName, @{n="TimeStamp";e={(Get-Date("01/01/1601")).AddHours($_.TimeStamp)}}