Skip to content

Instantly share code, notes, and snippets.

@countingpine
Last active October 20, 2020 13:17
Show Gist options
  • Save countingpine/38adbc09c6db7cd08a4db1eea506da72 to your computer and use it in GitHub Desktop.
Save countingpine/38adbc09c6db7cd08a4db1eea506da72 to your computer and use it in GitHub Desktop.
DNS Made Easy - Dynamic DNS Updater in PowerShell
$ID = 123456789
$PASSWORD = "%68%75%6e%74%65%72%32"
$DIR = $env:USERPROFILE
$WHATSMYIP_URL = "https://ifconfig.me/ip"
$oldip = (Get-Content "$DIR\ddns-publicip.txt")
$ip = (Invoke-RestMethod $WHATSMYIP_URL)
if ($ip -ne $oldip) {
$url = "https://cp.dnsmadeeasy.com/servlet/updateip?id=$ID&password=$PASSWORD&ip=$ip"
$result = (Invoke-RestMethod $url)
Write-Output "$(Get-Date) $result" >> "$DIR\ddns-result.txt"
if ($result -eq "success") {
Write-Output $ip > "$DIR\ddns-publicip.txt"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment