JSI Tip 10157. How can I retrieve the DNS name of a domain controller from the registry?
Jerold Schulman
February 13, 2006
1 Min Read
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_MACHINESoftwareMicrosoftWindowsCurrentVersionGroup PolicyHistory 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="HKLMSoftwareMicrosoftWindowsCurrentVersionGroup PolicyHistory"set DCName=NONEfor /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
About the Author
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.
You May Also Like