Last active
October 20, 2020 13:17
-
-
Save countingpine/38adbc09c6db7cd08a4db1eea506da72 to your computer and use it in GitHub Desktop.
DNS Made Easy - Dynamic DNS Updater in PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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