Skip to content

Instantly share code, notes, and snippets.

@NandoSangenetto
Last active April 22, 2023 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NandoSangenetto/24c3225b36d4843a6ddbe8c0dc2ed545 to your computer and use it in GitHub Desktop.
Save NandoSangenetto/24c3225b36d4843a6ddbe8c0dc2ed545 to your computer and use it in GitHub Desktop.
Update Google Domain's Dynamic DNS on Windows with batch files

Configuration

  • The reason to exist the HideBat.vbs is to hide the cmd prompt when it runs.
  • You can change the frequency when this script will be run in the scheduler.bat file.
  • Update the updateip.bat with your USERNAME and PASSWORD from the Dynamic DNS section in your Google Domains' DNS page. Also replace the PUT_YOUR_HOSTNAME_HERE with the hostname you want to update.

To make it run

  • Complete the configuration part.
  • Make sure that all files are in the same directory.
  • Run the scheduler.bat file to make it run every 5 minutes (with default config).
  • If you want to run it once, just run the HideBat.vbs file.
scriptdir = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
CreateObject("Wscript.Shell").Run scriptdir + "\updateip.bat", 0, True
schtasks /create /sc MINUTE /mo 5 /tn "UpdateIP" /tr "%cd%\HideBat.vbs"
@echo off
SET USERNAME=
SET PASSWORD=
for /F %%I in ('curl -s https://domains.google.com/checkip') do set IP=%%I
SET "HOSTNAME=hostname=PUT_YOUR_HOSTNAME_HERE"
SET "MYIP=&myip=%IP%"
SET "URL=https://%USERNAME%:%PASSWORD%@domains.google.com/nic/update?%HOSTNAME%%MYIP%"
curl "-s" "%URL%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment