Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- This script is used to check and update your GoDaddy DNS server to the IP address of your current internet connection.
- First go to GoDaddy developer site to create a developer account and get your key and secret
- https://developer.godaddy.com/getstarted
- Update the first 4 varriables with your information
- Details:
- https://au.godaddy.com/community/Managing-Domains/Dynamic-DNS-Updates/td-p/7862
- https://github.com/markafox/GoDaddy_Powershell_DDNS/blob/master/godaddy_ddns.ps1
- #>
- $domain = 'anonit.net' # your domain
- $name = 'mail','@' #name of the A record to update, can be multiples
- $key = 'This_is_a_fake_key_kfajewq8wu30r28wjlksJDF90*23f' #key for godaddy developer API
- $secret = 'Not_a_real_secret_alwkjf9832wj4f2LKJ8ejcas' #Secret for godday developer API
- $headers = @{}
- $headers["Authorization"] = 'sso-key ' + $key + ':' + $secret
- $result = Invoke-WebRequest https://api.godaddy.com/v1/domains/$domain/records/A/$name -method get -headers $headers
- $content = ConvertFrom-Json $result.content
- $dnsIp = $content.data
- # Get public ip address there are several websites that can do this.
- $currentIp = Invoke-RestMethod http://ipinfo.io/json | Select -exp ip
- ForEach ($dnsname in $name) {
- if ( $currentIp -ne $dnsIp) {
- $Request = @{ttl=600;data=$currentIp }
- $JSON = "[" + (Convertto-Json $request) + "]"
- Invoke-WebRequest https://api.godaddy.com/v1/domains/$domain/records/A/$dnsname -method put -headers $headers -Body $json -ContentType "application/json"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement