本帖最后由 kk_lee69 于 2022-8-12 15:54 编辑
可惜这都不是我所能够了解的…..所以只好上来询问 看看有无高手 可以协助 改写成 AUTOIT的语法的 $mydomain = "sos-obx.us"
$myhostname = "gateway"
$gdapikey = "api_key:key_secret"
$myip = Invoke-RestMethod -Uri "https://api.ipify.org"
$dnsdata = Invoke-RestMethod "https://api.godaddy.com/v1/domains/$($mydomain)/records/A/$($myhostname)" -Headers @{ Authorization = "sso-key $($gdapikey)" }
$gdip = $dnsdata.data
Write-Output "$(Get-Date -Format 'u') - Current External IP is $($myip), GoDaddy DNS IP is $($gdip)"
If ( $gpid -ne $myip) {
Write-Output "IP has changed!! Updating on GoDaddy"
Invoke-RestMethod -Method PUT -Uri "https://api.godaddy.com/v1/domains/$($mydomain)/records/A/$($myhostname)" -Headers @{ Authorization = "sso-key $($gdapikey)" } -ContentType "application/json" -Body "[{`"data`": `"$($myip)`"}]";
}
|