When the DNS Server service starts, it can get it's information from a BIND-style file named Boot, from the registry, or from Active Directory.

I have scripted BootMethod.bat to return the DNS start method.

The syntax for using BootMethod.bat on your DNS server is:

\[Call\] BootMethod Code \[X\]


<b>Code</b> is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain:

     <b>0</b> - Unknown

     <b>1</b> - Use the BIND-style file at <b>%SystemRoot%\System32\DNS\Boot</b>. If some information is missing, check the registry.

     <b>2</b> - Use information from the <b>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNS</b> registry sub-key.

     <b>3</b> - Use Active Directory, and use the registry for missing information.

<b>X</b>    is an optional parameter that causes <b>BootMethod.bat</b> to use the <a href="/article/jsifaq/jsi-tip-3905-manage-windows-2000-dns-from-the-command-prompt-.aspx"><b>DNSCMD.EXE</b></a>
 tool instead of the <b>REG.EXE</b> tool.
NOTE: The BootMethod Value Name used in this script replaces the EnableRegistryBoot Value Name used in Windows NT.

BootMethod.bat contains:

@echo off
if \{%1\}<h1><a name="_echo_Syntax_BootMethod_Code_X_amp_goto_EOF_setlocal_set_Code_0_if_2_">\{\} @echo Syntax: BootMethod Code \[X\]&goto :EOF
set Code=0
if \{%2\}</a></h1>\{\} goto RegRead
set line= 0
for /f "Tokens=2 Delims==" %%a in ('dnscmd /info^|FIND /i "fBootMethod"') do (
 set line=%%a
set Code=%line:~1,1%
endlocal&set %1=%Code%
goto :EOF
set key=HKLM\SYSTEM\CurrentControlSet\Services\DNS\Parameters
call :quiet
endlocal&set %1=%Code%
goto :EOF
For /f "Tokens=1,3" %%a in ('REG QUERY %key% /V BootMethod^|FIND /i "BootMethod"') do (
 set Code=%%b