diff --git a/README.md b/README.md index 516e299..b6ef160 100644 --- a/README.md +++ b/README.md @@ -37,14 +37,15 @@ rename the folder to _DDNS-Cloudflare-PowerShell_ place in a directory of your c Update the config parameters inside the update-cloudflare-dns_conf.ps1 by editing accordingly. See below for examples. -| **Option** | **Example** | **Description** | -| ------------------------- | ---------------- | --------------------------------------------------------- | -| what_ip | internal | Which IP should be used for the record: internal/external | -| dns_record | ddns.example.com | DNS **A** record which will be updated | -| cloudflare_zone_api_token | ChangeMe | Cloudflare API Token **KEEP IT PRIVATE!!!!** | -| zoneid | ChangeMe | Cloudflare's Zone ID | -| proxied | false | Use Cloudflare proxy on dns record true/false | -| ttl | 120 | 120-7200 in seconds or 1 for Auto | +| **Option** | **Example** | **Description** | +| ------------------------- | ---------------------------------------- | --------------------------------------------------------- | +| what_ip | internal | Which IP should be used for the record: internal/external | +| dns_record | ddns.example.com | DNS **A** record which will be updated | +| cloudflare_zone_api_token | ChangeMe | Cloudflare API Token **KEEP IT PRIVATE!!!!** | +| zoneid | ChangeMe | Cloudflare's Zone ID | +| proxied | false | Use Cloudflare proxy on dns record true/false | +| ttl | 120 | 120-7200 in seconds or 1 for Auto | +| comment | Updated using DDNS-Cloudflare-PowerShell | For record keeping, no effect on DNS itself | ### Optional Notifications Parameters for Telegram diff --git a/update-cloudflare-dns.ps1 b/update-cloudflare-dns.ps1 index 9d44ee2..41389de 100644 --- a/update-cloudflare-dns.ps1 +++ b/update-cloudflare-dns.ps1 @@ -160,7 +160,7 @@ $cloudflare_record_info = @{ $cloudflare_record_info_resposne = Invoke-RestMethod -Proxy $http_proxy -ProxyCredential $proxy_credential @cloudflare_record_info if ($cloudflare_record_info_resposne.success -ne "True") { - Write-Output "Error! Can't get $dns_record record inforamiton from cloudflare API" | Tee-Object $File_LOG -Append + Write-Output "Error! Can't get $dns_record record information from cloudflare API" | Tee-Object $File_LOG -Append Exit } @@ -181,6 +181,7 @@ $update_dns_record = @{ "content" = $ip "ttl" = $ttl "proxied" = $proxied + "comment" = $comment } | ConvertTo-Json } @@ -191,7 +192,7 @@ if ($update_dns_record_response.success -ne "True") { } Write-Output "==> Success!" | Tee-Object $File_LOG -Append -Write-Output "==> $dns_record DNS Record Updated To: $ip, ttl: $ttl, proxied: $proxied" | Tee-Object $File_LOG -Append +Write-Output "==> $dns_record DNS Record Updated To: $ip, ttl: $ttl, proxied: $proxied. `ncomment: $comment" | Tee-Object $File_LOG -Append if ($notify_me_telegram -eq "no" -And $notify_me_discord -eq "no") { diff --git a/update-cloudflare-dns_conf.ps1 b/update-cloudflare-dns_conf.ps1 index 3042ae2..e6e879a 100644 --- a/update-cloudflare-dns_conf.ps1 +++ b/update-cloudflare-dns_conf.ps1 @@ -2,19 +2,21 @@ ## Which IP should be used for the record: internal/external ## Internal interface will be chosen automaticly as a primary default interface -$what_ip = "internal" +$what_ip = "external" ## DNS A record to be updated $dns_record = "ddns.example.com" ## Use IPv6 $IPv6 = $false ## if use DoH to query the current IP address $DNS_over_HTTPS = $false -## Cloudflare's Zone ID +## Cloudflare's Zone ID - Cloudflare Dashboard -> Websites -> example.com -> Overview -> API Zone ID on right-hand sidebar $zoneid = "ChangeMe" -## Cloudflare Zone API Token +## Cloudflare Zone API Token - Instructions: https://github.com/fire1ce/DDNS-Cloudflare-PowerShell/blob/main/README.md#creating-cloudflare-api-token $cloudflare_zone_api_token = "ChangeMe" ## Use Cloudflare proxy on dns record true/false $proxied = $false +## Comment to put on the updated record +$comment = "Updated with fire1ce's DDNS-Cloudflare-PowerShell script $((Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))" ## 60-7200 in seconds or 1 for Auto $ttl = 120