Using Google domains with a dynamic IP

This is a script to read the current public IP and update your Google domain with the new IP-

#get the current IP
$url = ""
$ip = Invoke-RestMethod $url
#send the new IP to Google
$updateCommand = "https://username:[email protected]/nic/update?$($ip.ip)"
Invoke-RestMethod $updateCommand

Here is some documentation on Google on how to change your DNS via API- The short version is make a domain or subdomain dynamic. When you do this there will be a username and password generated for you, use this in the above script.