We will be using PsTools (https://docs.microsoft.com/en-us/sysinternals/downloads/psexec) to perform this operation.
Create a text file containing IP Addresses or hostnames (one per line). I will save this file as D:\hosts.txt
172.35.20.101
172.35.20.102
172.35.20.103
172.35.20.104
To change the primary DNS server, run the following command:
PsExec @D:\hosts.txt -u <username> netsh interface ip add dns name="Interface Name" static 172.25.30.100
#Replace <username> with a user with administrative rights
#Replace "Interface name" with your real interface name. Eg "Ethernet2"
To add a secondary DNS Server, run the following command:
PsExec @D:\hosts.txt -u <username> netsh interface ip add dns name="Interface Name" 172.25.30.100 index=2
#Watch out the missing *static* word