Automatically update your dynamic IP address in Cloudflare DNS using PowerShell. Ideal for home servers, VPNs, and remote access setups where your public IP changes frequently.
- 🔍 Retrieves Zone ID automatically
- 🌐 Updates A-record (IPv4) and optionally AAAA-record (IPv6)
- ⚡ Only updates DNS when your IP changes
- 🛠️ Fast, lightweight, and easy to configure
- 💻 PowerShell 5.1 or later (Windows, Linux, macOS)
- 🔑 Cloudflare API Token with
Zone.DNSpermissions
- Download
cloudflare_DDNS.ps1to your system. - Open the script and fill in the configuration section:
ApiToken: Your Cloudflare API tokenZoneName: Your domain/zone (e.g.example.com)RecordName: The FQDN to update (e.g.home.example.com)- Adjust other options as needed (TTL, Proxied, IPv6)
- Run the script:
.\cloudflare_DDNS.ps1To keep your DNS records updated automatically, you can run this script as a scheduled task:
- Open Task Scheduler and create a new task.
- Set the trigger (e.g. every 30 minutes).
- Set the action:
- Program/script:
powershell.exe - Add arguments:
-File "C:\Path\To\cloudflare_DDNS.ps1" - Start in:
C:\Path\To\
- Program/script:
- Make sure the task runs with highest privileges and is set to run whether user is logged in or not.
- Save and enable the task.
Example PowerShell command for quick setup:
SchTasks /Create /SC MINUTE /MO 30 /TN "CloudflareDDNS" /TR "powershell.exe -File C:\Path\To\cloudflare_DDNS.ps1" /RL HIGHEST /F$ApiToken = "YOUR_API_TOKEN"
$ZoneName = "example.com"
$RecordName = "home.example.com"
$TTL = 120
$Proxied = $false
$EnableIPv6 = $false- The script checks multiple public IP sources for reliability.
- IPv6 support is optional and can be enabled in the config.
- No third-party dependencies required.
MIT