JSI Tip 7760. How can I determine if Dynamic DNS Registration is enabled on a Windows XP client?

Jerold Schulman

February 17, 2004

1 Min Read
ITPro Today logo in a gray background | ITPro Today

I have scripted DynDNS.bat to determine if Dynamic DNS Registration is enabled on a Windows XP client.

The syntax for using DynDNS.bat is:

Call DynDNS YesNoX

Where YesNoX is a call directed environment variable that will contain a X if the client is NOT a Windows XP computer, a Y if Dynamic DNS Registration is enabled, and a N if Dynamic DNS Registration is NOT enabled.

DynDNS.bat contains:

@echo offsetlocal ENABLEDELAYEDEXPANSIONif {%1}=={} goto syntaxset DNSREG=Nif not exist "%SystemRoot%System32reg.exe" goto notxpset XP=reg.exe query "HKLMSOFTWAREMicrosoftWindows NTCurrentVersion"for /f "Tokens=1-3" %%u in ('%XP%^|Find "5.1"^|Find /i "CurrentVersion"') do ( if /i "%%u" NEQ "CurrentVersion" goto notxp)for /f "Tokens=3 Delims=[] " %%i in ('ping -n 1 "%computername%" ^|find /i "Pinging"') do ( set IP=%%i)if not defined IP goto errorset IP=%IP: =%set int1=reg.exe query HKLMSYSTEMCurrentControlSetServicesTcpipParametersInterfacesfor /f "Tokens=*" %%a in ('%int1%^|Find "{"') do ( set ikey=%%a if "!DNSREG!" EQU "N" call :IsInt)endlocal&set %1=%DNSREG%&exit /b 0:notxpset DNSREG=Xendlocal&set %1=%DNSREG%&exit /b 0:syntax@echo call DynDNS YesNo [PathToReg.exe]endlocalexit /b 1:error@echo DynDNS - Error retrieving IP address.endlocalexit /b 2:IsIntset IPFnd=Nset int2=reg.exe query %ikey%for /f "Tokens=*" %%i in ('%int2%^|Find "%IP%"^|Find /i "IPAddress"') do ( set IPFnd=Y)if "%IPFnd%" EQU "N" goto :EOFfor /f "Tokens=3" %%i in ('%int2%^|Find /i "RegistrationEnabled"') do ( if "%%i" EQU "0x1" set DNSREG=Y)



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