If you do not want to install the desktop update client, you can keep your hostname updated with a small script and a scheduled task in Windows.
This guide uses the CheckIP Tool to detect your public IP address and the Dynamic DNS Update API to send the update.
Quick summary
- Open PowerShell
- Get your Dyn update client key from your profile page
- Download the script, move it into
%USERPROFILE%\Dyn, and update it with your hostname and Dyn username - Run the script once from PowerShell so it can create the key file for you
- Paste your key into that file, then run the script again to confirm it works
- Schedule the script to run every 10 minutes
File locations
- Script:
%USERPROFILE%\Dyn\update-dyndns.ps1 - Key:
%USERPROFILE%\Dyn\ddns-key.txt - Log:
%USERPROFILE%\Dyn\ddns-update.log
Before you begin
Before you create the script, make sure you have:
- A Dyn account
- A Dynamic DNS hostname or Standard DNS hostname that accepts dynamic updates
- Your Dyn username
- Your update client key
The update API can use either your account password or an update client key. This guide uses and strongly recommends the update client key because it can update your hostname but cannot be used to sign in to your Dyn account.
You can view or generate your update client key on your profile page at https://account.dyn.com/profile/:
- If you do not already have a key, click
Generate Key - If you already have a key, click
Show Key
Use HTTPS for all update requests. Do not put your account password or update client key directly into one-off commands that will be stored in PowerShell history or shell history.
Security recommendations
Store your update client key in a file that only your Windows account can read.
Recommended file location:
%USERPROFILE%\Dyn\ddns-key.txt
After creating the file, confirm that access is restricted to your user account and local administrators only.
If you share the computer with other users, do not save the secret inside the scheduled task action or in a shortcut.
Download and prepare the PowerShell script
- Download update-dyndns.ps1 into your Downloads folder.
- Open PowerShell.
- Create
%USERPROFILE%\Dynif it does not already exist:
New-Item -ItemType Directory -Path "$env:USERPROFILE\Dyn" -Force
- Move the script from Downloads into
%USERPROFILE%\Dyn:
Move-Item -Path "$env:USERPROFILE\Downloads\update-dyndns.ps1" -Destination "$env:USERPROFILE\Dyn\update-dyndns.ps1" -Force
- Open the script in Notepad:
notepad "$env:USERPROFILE\Dyn\update-dyndns.ps1"
- Replace
yourhost.example.comwith your hostname andyour-dyn-usernamewith your Dyn username, then save the file.
Run the script and add your key
Expected first-run behavior: the script creates %USERPROFILE%\Dyn\ddns-key.txt and then exits. This is normal.
Run the script from PowerShell with this command:
powershell.exe -ExecutionPolicy Bypass -File "$env:USERPROFILE\Dyn\update-dyndns.ps1"
-ExecutionPolicy Bypass applies only to this PowerShell process. It helps you run the script without permanently
changing the system execution policy.
Do not use the Windows Run box for the first test. If the script exits immediately, the PowerShell window may close before you can read the error. Run it from an open PowerShell window so you can review any messages.
On the first run, if the key file does not exist yet, the script creates %USERPROFILE%\Dyn\ddns-key.txt and stops.
Open that file in Notepad:
notepad "$env:USERPROFILE\Dyn\ddns-key.txt"
Paste your update client key into the file, save it, then run the script again:
powershell.exe -ExecutionPolicy Bypass -File "$env:USERPROFILE\Dyn\update-dyndns.ps1"
Test the script before scheduling
After you save your update client key and run the script again, review the log file:
notepad "$env:USERPROFILE\Dyn\ddns-update.log"
Common successful responses include good and nochg. If you receive an error response, review the
Return Codes reference.
Expected results
- On the first run, if the key file does not exist yet, the script creates
%USERPROFILE%\Dyn\ddns-key.txtand stops. - After you add your update client key and run the script again, a successful result is usually
goodornochg.
Create the scheduled task
Use Task Scheduler to run the script automatically.
- Open Task Scheduler
- Select Create Task
- Enter a name such as
Dyn Dynamic DNS Update - Select Run whether user is logged on or not if this computer stays on unattended
- On the Triggers tab, create a new trigger:
- Begin the task: On a schedule
- Repeat task every: 10 minutes
- For a duration of: Indefinitely
- On the Actions tab, create a new action:
- Program/script:
powershell.exe - Add arguments:
-ExecutionPolicy Bypass -File "%USERPROFILE%\Dyn\update-dyndns.ps1" - Save the task and enter your Windows password if prompted
Do not schedule the task more often than every 10 minutes. The examples in this guide use a 10-minute interval to match Dyn guidance and reduce unnecessary requests.
Verify that scheduled updates are working
Use these checks after saving the task:
- In Task Scheduler, select the task and choose Run to test it immediately
- Confirm a new entry appears in
%USERPROFILE%\Dyn\ddns-update.log - Review the Last Run Result and the History tab in Task Scheduler
- In your Dyn account, confirm the hostname shows the expected current IP address and latest update time
If your IP address has not changed, a nochg response is normal.
Troubleshooting
The script cannot detect my IP address
- Confirm the computer can reach
http://checkip.dyndns.org/ - If CheckIP fails, do not send an update request
- Make sure your firewall or proxy is not rewriting the response in a way that prevents the IP match
Windows blocks the script
- Run the script from an open PowerShell window instead of the Windows Run box
- Use
-ExecutionPolicy Bypassexactly as shown in this guide - Make sure the script path matches
%USERPROFILE%\Dyn\update-dyndns.ps1
I receive authentication errors
- Confirm the Dyn username is correct
- Confirm the update client key file contains the correct current value
- If you recently generated a new update client key, update the saved key file
I receive abuse or frequent warning responses
- Make sure you are not running more than one updater for the same hostname
- Do not schedule updates more often than every 10 minutes
- Avoid forcing updates when your IP address has not changed unless you are testing
Remove the scheduled task
If you no longer want to use this method:
- Open Task Scheduler
- Find the
Dyn Dynamic DNS Updatetask - Select Disable or Delete
- Remove
%USERPROFILE%\Dyn\update-dyndns.ps1,%USERPROFILE%\Dyn\ddns-key.txt, and the log file if you no longer need them
