Change DNS settings for all network adapters

2

1

I know how you can change the DNS settings for a particular network adapter from Network and Sharing Center.

The problem I'm facing is that each time I connect my phone(s) over USB to use the tethered internet connection, they show up as a new adapter with a random name.

How can I configure Windows to use the same DNS settings for all network adapters?

The ideal solution would be a setting/script that needs to be configured/run only once, and not each time I tether.

rahuldottech

Posted 2019-09-28T15:37:59.170

Reputation: 5 095

If you add the DNS in one network adapter settings, does Window remember it next time you plug in phone? In my case (android 8) network adapter is similar but Network number is increasing every restart/shutdown. – Biswapriyo – 2019-10-06T20:43:42.530

Answers

1

A PowerShell command to reset the DNS server on all adapters is:

Get-NetAdapter | set-DnsClientServerAddress -ServerAddresses ("8.8.8.8","1.1.1.1")

You may put the command inside a PowerShell .ps1 script and either run it manually or even schedule it to run automatically whenever a new network connection is detected.

For the latter, see the post How to launch a command on network connection/disconnection for instructions on using the Task Scheduler for creating a trigger that runs this script when a connection is detected.

This trigger will run upon connecting to all networks, but it is always possible to refine it.

harrymc

Posted 2019-09-28T15:37:59.170

Reputation: 306 093