📎 AI Summary:
The original poster is seeking a command to remove existing DNS entries from the advanced TCP/IP settings to reconfigure their order, as manual updates are impractical for over 50 VMs. A responder suggests that `netsh` cannot reorder DNS entries directly and recommends deleting all current DNS entries first, then re-adding them in the desired order. The overall sentiment is technical assistance, focusing on scripting network configuration changes efficiently across multiple virtual machines.

rman91

New Member
Joined
Mar 13, 2018
Messages
1
Thread Author #1
Hi All

Wondering if anyone knows a command to remove the DNS entries within the advanced TCP/IP settings?

The primary and secondary DNS IP need to be changed with the tertiary and quaternary DNS IP. Simple enough doing it manually but there's over 50 VMs this needs to be done on so i'm trying to write a script for this.

i did try to the below command but as the IPs are already added it wouldn't re-arrange them into the given order

e.g. (IPs have been randomised)

netsh dnsclient add dnsserver "Local Area Connection" 10.91.201.56 1

netsh dnsclient add dnsserver "Local Area Connection" 10.91.201.57 2

netsh dnsclient add dnsserver "Local Area Connection" 10.91.207.55 3

netsh dnsclient add dnsserver "Local Area Connection" 10.91.207.54 4

Any help is greatly appreciated - thanks
 

Solution
netsh isn't very robust. You won't be able to reorder them. What you will want to do is remove all the entries and re-add them.

netsh interface ipv4 delete dnsservers "Local Area Connection" 10.91.201.56
..57
..55
..54

then re-add in the order you want
netsh interface ipv4 add dnsservers "Local Area Connection" <address> index=#

Neemobeer

Windows Forum Team
Staff member
Joined
Jul 4, 2015
Messages
8,995
netsh isn't very robust. You won't be able to reorder them. What you will want to do is remove all the entries and re-add them.

netsh interface ipv4 delete dnsservers "Local Area Connection" 10.91.201.56
..57
..55
..54

then re-add in the order you want
netsh interface ipv4 add dnsservers "Local Area Connection" <address> index=#
 

Solution