Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 



JSI Tip 10054. How often does DNS scavenge its database?

RSS
Subscribe to Windows IT Pro | See More Domain Name System (DNS) Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!


10054 » How often does DNS scavenge its database? 12-Jan-06


If you have enabled scavenging for all zones, or any specific zone, the default scavenging interval is 168 hours (hexadecimal 0xA8, or 7 days, or 1 week).

To set the scavenging interval:

1. Open the DNS snap-in.

2. Right-click the server name and press Properties.

3. Select the Advanced tab.

4. Check the Enable automatic scavenging of stale records box.

5. Set the Scavenging period.

6. Press Apply.

7. Press OK.

Using REG.EXE, built into Windows XP, Windows Server 2003, and later operating systems, or installed from the Windows 2000 Support Tools, and Hex2Dec freeware from SysInternals, I have scripted ScavengingInterval.bat to display the scavenging interval in decimal hours.

The syntax for using ScavengingInterval.bat is:

ScavengingInterval [LAN]

Where LAN is optional name of your connection, like JSIINC. If not specified, it will default to Local Area Connection.

The scavenging interval number of hours is displayed on the console. To import it an environment variable:

for /f "Tokens=*" %%s in ('ScavengingInterval [LAN]') do set /a ScavengingInterval=%%s

If ScavengingInterval.bat returns a 0, scavenging has been disabled.

ScavengingInterval.bat contains:


@echo off
setlocal ENABLEDELAYEDEXPANSION
set LAN="Local Area Connection"
if {%1} NEQ {} set LAN=%1
set LAN=%LAN:"=%
set LAN=Ethernet adapter %LAN%:
set OK=N
set DNSIP=NONE
set Zone=NONE
for /f "Tokens=*" %%a in ('IPCONFIG /ALL') do (
 set line=%%a
 for /f "Tokens=*" %%x in ('@echo %%a ^|find "Ethernet adapter "') do set OK=N
 for /f "Tokens=*" %%x in ('@echo %%a ^|find "%LAN%"') do set OK=Y
 if "!OK!" EQU "Y" for /f "Tokens=*" %%x in ('@echo %%a ^|find "DNS Servers . . . . . . . . . . . : "') do set DNSIP=!line:~36!
)
set qry=REG QUERY \\%DNSIP%\HKLM\SYSTEM\CurrentControlSet\Services\DNS\Parameters /V ScavengingInterval
set si=0x0
for /f "Tokens=1,3" %%a in ('%qry%^|find /i "ScavengingInterval"') do (
 set si=%%b
)
for /f "Skip=4 Tokens=2 Delims== " %%x in ('hex2dec %si%') do (
 @echo %%x
)
endlocal



End of Article



Reader Comments

You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Friday at PASS Europe 2006

Kevin talks about the closing day of the event and shares a funny Microsoft film. ...

PsExec

This freeware utility lets you execute processes on a remote system and redirect output to the local system. ...

Escape From Yesterworld

Kevin points you to the funniest SQL Server website ever! ...


Related Events Check out our list of Free Email Newsletters!

Related Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing