Afraid.org (DNS) Windows VB Script Update

Whilst very busy I host a handful of websites for friends and family from my garage fibre connection. The thing is my ISP doesn’t provide me an a static IP address. This is obviously an issue when hosting websites.

This can be solved in one of two ways
1. obtain a static IP address either by changing your ISP or plan (if possible)
2. change your A records when your public IP address changes.

I elected to go with option 2.

After evaluating providers our there I settled with Afraid. The clinching factor was the ability to change your A records via an API call over HTTP. Other providers lacked this feature and the 5 years now I have been using Afraid and they have been rock solid with no apparent outages.

Afraid provide multiple ways to update your A record via HTTP but really its more focussed around Linux and the examples other people have written are cumbersome batch files

With hosting multiple sites I wanted a better more streamlined way to update my A records. For that purpose I wrote a VBScript that can be scheduled in Windows.


' **************************************************
' * Author - Shane Baldacchino *
' * Version - 1.0 *
' * Email - shane@baldacchino.net *
' * File Name - DNS_Public.vbs *
' * Script Language - Microsoft VB Script *
' * Creation Date - Thursday 18th, September 2014 *
' * Modified Date - Thursday 18th, September 2014 *
' **************************************************

'---------------- EDIT BELOW THIS LINE --------------------------------
'Versions
ScriptVersion = 1.0

'Domain 1
Set objHTTP = CreateObject("Microsoft.XMLHTTP")
'Replace the GET URL to that of what is listed in Afraid.org for your domain
objHTTP.open "GET","http://freedns.afraid.org/dynamic/update.php?xxxxxxxxxxx", False
objHTTP.send
'Replace 'domain 1' with your domain name
wscript.echo now & " | domain 1 - " & objhttp.responsetext

'Cut and paste the above to add in multiple domains
'---------------- DO NOT EDIT BELOW THIS LINE -------------------------

Execution can be performed by using the cscript VB compiler.


cscript DNS_Public.vbs

Which yields the response in my case of


C:ArchiveScripts>cscript DNS_Public.VBS
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

17/12/2014 1:36:35 PM | domain 1 - ERROR: Address 124.168.106.85 has not
changed.

17/12/2014 1:36:35 PM | domain 2 - ERROR: Address 124.168.106.85 h
as not changed.

17/12/2014 1:36:41 PM | domain 3 - ERROR: Address 124.168.106.85 has n
ot changed.

17/12/2014 1:36:42 PM | domain 4 - ERROR: Address 124.168.106.85 has n
ot changed.

17/12/2014 1:36:42 PM | domain 5 - ERROR: Address 124.168.106.85 has
not changed.

A copy of this VB script can be downloaded here

Shane Baldacchino

Leave a Comment