PowerShell is the future, but there are yet some machines in the past or present. So I chose instead to use plain old tried and true VBS which works for Windows XP through 2012 R2.
Paste the below content into a text document, and give it a good name with an extension of ".vbs".
strFileURL = "https://api.ipify.org"
Set objXMLHTTP = CreateObject("Microsoft.XMLHTTP")
objXMLHTTP.open "GET", strFileURL, false
objXMLHTTP.send()
myIP = objXMLHTTP.responseText
updateURL = "https://dynupdate.no-ip.com/nic/update?hostname=sdrc.ddns.net&myip=" & myIP
Set objXMLHTTP2 = CreateObject("Microsoft.XMLHTTP")
objXMLHTTP2.open "GET", updateURL, false
objXMLHTTP2.setRequestHeader "Authorization", "Basic <your credentials*>"
objXMLHTTP2.setRequestHeader "User-Agent", "Custom NoIP Update Client weonlydo@mailinator.com"
objXMLHTTP2.send()
Use Windows Task Scheduler to run it. The main trigger to use is "On startup", but because the network interface may not be ready at startup, it may work best to edit the trigger properties and add a small delay (e.g. 30 seconds). To get maximum coverage, you could have two startup triggers, one immediately, and the other delayed by two minutes.
Some notes about the scheduled task:
Some notes about the scheduled task:
- Use the System account, or choose a user and provide a password, both will work
- You cannot use the VBS file as the "Start Program" directly. Use "cscript" as the program, and the full path of the file in double quotes as the "arguments"
About credentials:
Replace <your credentials> in the script with the base-64 encoded version of your credentials used to log into the No-IP website. e.g. if you log into No-IP using
Replace <your credentials> in the script with the base-64 encoded version of your credentials used to log into the No-IP website. e.g. if you log into No-IP using
email: my@email.address
password: mynoippassword
The authorization string would be "Basic bXlAZW1haWwuYWRkcmVzczpteW5vaXBwYXNzd29yZA=="
The site https://www.base64encode.org/ is useful for converting your credentials into the base-64 encoded format. In the top part, enter "my@email.address:mynoippassword" without quotes and press the "Encode" button. If you end up with the same code as the above paragraph, congratulations - you have done it correctly. Now you can encode your own credentials and paste into the script.
References:
Here is the official documentation for updating your Dynamic DNS entry at No-IP.
No comments:
Post a Comment