10157 » How can I retrieve the DNS name of a domain controller from the registry? 14-Feb-06
A good place to determine the DNS name of a domain controller in a Startup script is from the DCName Value Name, a string
data type, at the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Group Policy\History key.
If your script, using REG.EXE, built into Windows XP, Windows Server 2003, and later operating systems, or installed from the
Windows 2000 Support Tools, contains:
set key="HKLM\Software\Microsoft\Windows\CurrentVersion\Group Policy\History"
set DCName=NONE
for /f "Tokens=1,2*" %%a in ('reg query %key% /V DCName^|find /i "DCName"^|find "REG_SZ"') do (
set DCName=%%c
)The %DCName% environment variable might contains:
\\JSI001.JSIINC.COM
End of Article

