A dynamic DNS client implemented in pure PowerShell based on the DNSPod user API.
This project is converted from rehiy/dnspod-shell and keeps the familiar command style from the original project.
- Pure PowerShell implementation
- Supports IPv4 (
A) and IPv6 (AAAA) records - Supports automatic record creation when the record does not exist
- Supports binding to a specific network interface
- Supports manual record creation and deletion
- Includes Windows scheduled-task auto-install scripts for PowerShell and CMD
- Includes mock tests and integration tests
- Windows PowerShell 5.1 or later
- A DNSPod API token in the format
ID,Token - Administrator privileges for
auto_install.ps1andauto_install.bat
Reference script: ddnspod.ps1
# Allow local script execution for the current user
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Load functions from GitHub
irm https://raw.githubusercontent.com/ztj1993/dnspod-powershell/refs/heads/main/ardnspod.ps1 | iex
# Set your DNSPod token
$arToken = "12345,7676f344eaeaea9074c123451234512d"
# Create the record automatically if it does not exist
$arIsCreateRecord = $true
# Update an IPv4 record
arDdnsCheck "test.org" "subdomain"
# Update an IPv6 record
arDdnsCheck "test.org" "subdomain6" 6
# Update by binding to a specific interface
arDdnsCheck "test.org" "subdomain" 4 "Ethernet"arDdnsCheck "<domain>" "<subdomain>" [4|6] [interface]Examples:
arDdnsCheck "example.com" "home"
arDdnsCheck "example.com" "home" 6
arDdnsCheck "example.com" "home" 4 "Ethernet"arDdnsCreate "example.com" "home" "A" "192.168.0.100"
arDdnsCreate "example.com" "home6" "AAAA" "2001:db8::100"arDdnsDelete "example.com" "home" 4
arDdnsDelete "example.com" "home6" 6Variables used by ardnspod.ps1 and ddnspod.ps1:
$arToken: DNSPod API token, formatID,Token$arIp4QueryUrl: public IPv4 query endpoint, defaulthttp://ipv4.ddnsip.cn$arIp6QueryUrl: public IPv6 query endpoint, defaulthttp://ipv6.ddnsip.cn$arLastRecordFile: cache file prefix for the last synced IP$arErrCodeUnchanged: optional exit code when the IP is unchanged$arIsCreateRecord: whether to create a missing record automatically
Both install scripts:
- download
ardnspod.ps1 - generate a task script in the target directory
- create an hourly Windows scheduled task
- start the task once immediately after installation
Default script directory:
%USERPROFILE%\Documents\PowerShell\DDNS
Reference script: auto_install.ps1
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
$env:AR_TOKEN="12345,7676f344eaeaea9074c123451234512d"
$env:AR_DOMAIN="test.org"
$env:AR_SUBDOMAIN="subdomain"
$env:AR_IP_VERSION="6"
$env:AR_INTERFACE="Ethernet"
$env:AR_IS_CREATE_RECORD="true"
irm https://raw.githubusercontent.com/ztj1993/dnspod-powershell/refs/heads/main/auto_install.ps1 | iexSupported parameters and environment variables:
TaskName/AR_TASK_NAME: scheduled task name, defaultDdnsTaskToken/AR_TOKEN: required DNSPod tokenDomain/AR_DOMAIN: required domainSubdomain/AR_SUBDOMAIN: required subdomainIpVersion/AR_IP_VERSION:4or6, default4Interface/AR_INTERFACE: optional network interface aliasIsCreate/AR_IS_CREATE_RECORD:trueorfalse, defaultfalseScriptDir/AR_SCRIPT_DIR: script output directoryScriptUrl/AR_SCRIPT_URL: customardnspod.ps1download URL
Show built-in help:
.\auto_install.ps1 -HelpReference script: auto_install.bat
set TASK_NAME=DdnsTask
set AR_TOKEN=12345,7676f344eaeaea9074c123451234512d
set AR_DOMAIN=test.org
set AR_SUBDOMAIN=subdomain
set AR_IP_VERSION=6
set AR_INTERFACE=Ethernet
set AR_IS_CREATE_RECORD=true
curl -sS -k -o %TEMP%\ddnspod.bat https://raw.githubusercontent.com/ztj1993/dnspod-powershell/refs/heads/main/auto_install.bat && %TEMP%\ddnspod.bat %TASK_NAME%The CMD installer reads configuration from these environment variables:
AR_TOKENAR_DOMAINAR_SUBDOMAINAR_IP_VERSIONAR_INTERFACEAR_IS_CREATE_RECORDAR_SCRIPT_DIRAR_SCRIPT_URL
Run the task immediately:
schtasks /run /tn "DdnsTask"Delete the scheduled task:
schtasks /delete /tn "DdnsTask" /fTest files:
tests/ardnspod.Mock.Tests.ps1tests/ardnspod.Integration.Tests.ps1
Run mock tests:
Invoke-Pester .\tests\ardnspod.Mock.Tests.ps1Run integration tests:
$env:AR_TOKEN="12345,token"
$env:AR_DOMAIN="example.com"
$env:AR_SUBDOMAIN="ddns-test"
Invoke-Pester .\tests\ardnspod.Integration.Tests.ps1Integration tests create and delete temporary DNS records. Use a safe test subdomain.
2026/04/22
- Updated English and Chinese documentation
- Added usage details for interface binding and auto-install parameters
- Added test instructions
2026/04/08
- Added automatic installation script for CMD
- Updated README
2025/03/19
- Initial release
- Added basic DDNS update support
- Added domain record deletion support
- Added manual domain record creation support