Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
January 9, 2006
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]
Where:
Code is a <a href="https://www.itprotoday.com/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: 0 - Unknown 1 - Use the BIND-style file at %SystemRoot%System32DNSBoot. If some information is missing, check the registry. 2 - Use information from the HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesDNS registry sub-key. 3 - Use Active Directory, and use the registry for missing information.X is an optional parameter that causes BootMethod.bat to use the DNSCMD.EXE tool instead of the REG.EXE tool.
NOTE: The BootMethod Value Name used in this script replaces the EnableRegistryBoot Value Name used in Windows NT.
BootMethod.bat contains:
@echo offif {%1}
<h1><a name="_echo_Syntax_BootMethod_Code_X_amp_goto_EOF_setlocal_set_Code_0_if_2_" id="_echo_Syntax_BootMethod_Code_X_amp_goto_EOF_setlocal_set_Code_0_if_2_">{} @echo Syntax: BootMethod Code [X]&goto :EOFsetlocalset Code=0if {%2}</a></h1>
{} goto RegReadset line= 0for /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:RegReadset key=HKLMSYSTEMCurrentControlSetServicesDNSParameterscall :quietendlocal&set %1=%Code%goto :EOF:quietFor /f "Tokens=1,3" %%a in ('REG QUERY %key% /V BootMethod^|FIND /i "BootMethod"') do ( set Code=%%b)
You May Also Like