The netsh dnsclient command is used to configure and manage Domain Name System (DNS) client settings on a Windows computer. It allows administrators to add, delete, set, and display DNS server addresses, encryption settings, and global DNS client options. This command is useful for automating DNS configuration, troubleshooting name resolution issues, and managing advanced DNS features such as DNS-over-HTTPS (DoH) and DNS-over-TLS (DoT).
Syntax
netsh dnsclient [add | delete | dump | help | set | show | ?]
netsh dnsclient add dnsserver [name=]<string> [address=]<IP address> [[index=]<integer>] [[validate=]yes|no]
netsh dnsclient add encryption [server=]<IP address> [dohtemplate=]<string> [dothost=]<hostname>:<port> [[autoupgrade=]yes|no] [[udpfallback=]yes|no]
netsh dnsclient add global [[doh=]yes|no|auto] [[dot=]yes|no] [[ddr=]yes|no]
netsh dnsclient add interface [name=]<string> [[ddr=]yes|no] [[ddrfallback=]yes|no]
netsh dnsclient delete dnsserver [name=]<string> [address=]<IP address> [[index=]<integer>] [[validate=]yes|no]
netsh dnsclient delete encryption [server=]<IP address> [[protocol=]doh|dot]
netsh dnsclient delete global [global=](doh|dot|ddr|all)
netsh dnsclient delete interface [name=]<string> [setting=](ddr|all)
netsh dnsclient <dump>
netsh dnsclient set dnsserver [name=]<string> [source=]dhcp|static [[address=]<IP address>|none] [[register=]none|primary|both] [[validate=]yes|no]
netsh dnsclient set encryption [server=]<IP address> [dohtemplate=]<string> [dothost=]<hostname>:<port> [[autoupgrade=]yes|no] [[udpfallback=]yes|no]
netsh dnsclient set global [[doh=]yes|no|auto] [[dot=]yes|no] [[ddr=]yes|no]
netsh dnsclient set interface [name=]<string> [[ddr=]yes|no] [[ddrfallback=]yes|no]
netsh dnsclient show encryption [[server=]<IP address>]
netsh dnsclient show [global | state]
Parameters
| Parameter | Description |
|---|---|
add dnsserver name=<string> address=<IP address> index=<integer> `validate=<yes |
no>` |
add encryption server=<IP address> dohtemplate=<string> dothost=<hostname>:<port> `autoupgrade=<yes |
no> udpfallback=<yes |
| add global `doh=<yes | no |
add interface name=<string> `ddr=<yes |
no> ddrfallback=<yes |
delete dnsserver name=<string> address=<IP address> index=<integer> `validate=<yes |
no>` |
delete encryption server=<IP address> `protocol=<doh |
dot>` |
| delete global `global=<doh | dot |
delete interface name=<string> `setting=<ddr |
all>` |
| dump | Outputs a configuration script containing the current DNS client settings. |
set dnsserver name=<string> `source=<dhcp |
static> address=<IP address> |
set encryption server=<IP address> dohtemplate=<string> dothost=<hostname>:<port> `autoupgrade=<yes |
no> udpfallback=<yes |
| set global `doh=<yes | no |
set interface name=<string> `ddr=<yes |
no> ddrfallback=<yes |
show encryption server=<IP address> |
Displays the encrypted DNS server settings from the list of statically configured secure resolvers. If no server is specified, information for all encrypted DNS servers is shown. server - Specifies the encrypted DNS server by IP address. |
show <global> |
Displays all configured DNS global settings. |
show <state> |
Displays the current configuration and status of the DNS client. |
| help or ? | Provides help for the list of commands available in the netsh dnsclient context. |
Examples
To add a DNS configuration or setting (for example, a specific DNS server address), run the following command:
netsh dnsclient add dnsserver Ethernet=192.168.10.1
To delete a DNS configuration or setting (such as a specific DNS server address), run the following command:
netsh dnsclient delete dnsserver Ethernet=192.168.10.1
To set a static DNS server address for a specific network interface, run the following command:
netsh dnsclient set dnsserver name=Ethernet source=static address=192.168.10.1 register=primary validate=yes
To show globally configured DNS settings, run the following command:
netsh dnsclient show global
Source: Microsoft Learn / Windows Server documentation by Microsoft and contributors (upstream author metadata: robinharwood). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
