DDNS Automatic Update Batch Scripts for Windows

Automatically update your DDNS domains (DNSMadeEasy) only when IP has changed and maintain a log of updates!

Synopsis

Some of us don't like to install unnecessary programs and have them take up residence in the memory. Updating DDNS on DNSMadeEasy shouldn't have to be one. If you're one of us, you might want to keep reading.

These automatic update batch scripts were tested on Windows XP, NT, 2000 Server, and Server 2003. Please drop me a note if you happen to make this run on other versions of Windows or DOS. Just follow the procedure and modify it to suit your needs. It may be somewhat difficult for some folks, so I've given detailed instructions here.

The following procedure assumes that you're running this from a machine that you want your domain to point to. This should work fine for DSL/Cable modem users or those behind firewall. Once you're done with the set up prescribed here, you should have an automated batch files which updates DDNS only when necessary, keeps a log of those updates and periodically delete that log to keep it from growing too big.

1. Setting up the files

Note: accountname is your email address you use to log into DNSMadeEasy and accountpw should be replaced with your password. And if you're using Windows XP, you probably have your system files under C:\WINDOWS and not C:\WINNT.

  1. Download a Windows version of Lynx (an open source text-based browser) and install it. Or if you don't want to go through the installation procedure you can download it from here and unzip it to your C:\WINNT directory.
     

  2. Create update-ddns.txt text file containing following single line of command and save it under C:\WINNT. Make sure you don't have any extra lines after this line.

    lynx -dump -lss=lynx.lss http://www.dnsmadeeasy.com/servlet/updateip?username=accountname^&password=accountpw^&id=%1^&ip=

    Please note that above command should be a single line without any carriage returns (or Enter key).  Make sure when you're creating it with Notepad, you don't create an extra line at the end of the file.
     

  3. Create upddns.bat file containing the following:

    @echo off
    copy %SystemRoot%\ip-new.txt %SystemRoot%\ip-cur.txt > nul
    copy %SystemRoot%\update-ddns.txt %SystemRoot%\upddns-temp.bat > nul
    type %SystemRoot%\ip-new.txt >> %SystemRoot%\upddns-temp.bat
    call %SystemRoot%\upddns-temp.bat %1
    del %SystemRoot%\upddns-temp.bat
     
  4. Create update-ddns.bat file containing the following:
    Note: Please change 123456, mydomain.com to your domain name and corresponding DDNS ID from DNSMadeEasy. If you have more domains to point to this machine then you can add more before the line goto endhere.

    @echo off
    lynx -dump -lss=lynx.lss http://whatismyip.org > %SystemRoot%\ip-new.txt
    if errorlevel==1 goto noconnection
    fc %SystemRoot%\ip-cur.txt %SystemRoot%\ip-new.txt > nul
    if errorlevel==1 goto ipchanged
    if errorlevel==2 goto ipchanged
    goto endhere
    :ipchanged
    date /t >> ddns.log
    time /t >> ddns.log
    type ip-new.txt >> ddns.log
    echo 123456, mydomain.com >> ddns.log
    call upddns 123456 >> ddns.log
    goto endhere
    :noconnection
    date /t >> ddns.log
    time /t >> ddns.log
    echo No connection to Internet! >> ddns.log
    :endhere
     
  5. Create del-ddnslog.bat file containing the following:

    @del %SystemRoot%\ddns.log

2. Running the scripts

Once you have created all of the necessary files, you should be able to update your DDNS of your domain by just running update-ddns.bat. There are probably countless possibilities on how you actually want to run it, but here are some recommendations:

  1. If this is for a workstation and you reset your Internet connection frequently then you might want to run this every time you log on to your computer by putting a shortcut of update-ddns.bat in your Startup folder under Programs. And you can put del-ddnslog.bat under Scheduled Tasks to run once a month. If you don't know how to create shortcuts or make a scheduled task, please consult your standard Help documentation available in Windows (F1 while in Desktop).
     
  2. If this is for a server and you have relatively constant Internet connection then you might want to run update-ddns.bat from Scheduled Tasks once a day and del-ddnslog.bat once every two months or so.
     
  3. If your IP changes incessantly for some reason, then have it run 1 or 2 minutes after idling. You can configure it via Scheduled Tasks by going through daily run option and then getting the advanced options to manually modify the intervals.

There should be nothing else to do except to check ddns.log time to time, or add, modify, or remove domain names from update-ddns.bat file.

3. Troubleshooting

4. Notes

5. Enjoy!

If you carefully followed above procedure and it still doesn't work for you, please let me know at clayjar@gmail.com. Or just drop me a note.

Here is a message board if you'd like to correspond with other users.

Last updated on May 5, 2004 by Michael Han

History

May 5, 2004 - Modified upddns.bat and update-ddns.bat files to update only when IP has changed and clarified some explanations.

April 31, 2004 - First online version with automatic update, simple log and delete log