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

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 off
if \{%1\}==\{\} goto syntax
if not exist "%SystemRoot%\System32\reg.exe" goto notxp
set XP=reg.exe query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
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 error
set IP=%IP: =%
set int1=reg.exe query HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
for /f "Tokens=*" %%a in ('%int1%^|Find "\{"') do (
 set ikey=%%a
 if "!DNSREG!" EQU "N" call :IsInt
endlocal&set %1=%DNSREG%&exit /b 0
endlocal&set %1=%DNSREG%&exit /b 0
@echo call DynDNS YesNo \[PathToReg.exe\]
exit /b 1
@echo DynDNS - Error retrieving IP address.
exit /b 2
set IPFnd=N
set 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 :EOF
for /f "Tokens=3" %%i in ('%int2%^|Find /i "RegistrationEnabled"') do (
 if "%%i" EQU "0x1" set DNSREG=Y

TAGS: Windows 8
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.