' Kod uaktywnia funkcj usuwania rekordw dla wszystkich stref zintegrowanych z usug Active Directory
' ------ KONFIGURACJA SKRYPTU ------
strServer = "<NazwaSerwera>"
intScavengingInterval = <LiczbaMinutOczyszczania>
intNoRefreshInterval  = <LiczbaMinutBezOdwieania>
intRefreshInterval    = <LiczbaMinutZOdwieaniem>
' ------ KONIEC KONFIGURACJI ---------
set objDNS = GetObject("winMgmts:\\" & strServer & "\root\MicrosoftDNS")
set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")

objDNSServer.ScavengingInterval        = intScavengingInterval
objDNSServer.DefaultNoRefreshInterval  = intNoRefreshInterval
objDNSServer.DefaultRefreshInterval    = intRefreshInterval
objDNSServer.DefaultAgingState         = TRUE
objDNSServer.Put_
WScript.Echo "Dla serwera skonfigurowano ustawienia funkcji usuwania rekordw."

set objZones = objDNS.ExecQuery("Select * from MicrosoftDNS_Zone " & _
                                "Where DnsServerName = '" & _
                                       objDNSServer.Name & "'" & _
                                "  And DsIntegrated = TRUE") 
WScript.Echo "Skonfigurowano nastpujce strefy zintegrowane z usug Active Directory: "
for each objZone in objZones
   WScript.Echo " " & objZone.Name & " Czas istnienia: " & objZone.Aging
   objZone.Aging = 1
   objZone.Put_
next
