cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
chris_sterner
Engaged Sweeper II
I have been trying to successfully run a script to change out our DNS servers. I have been using 4 different scripts because the Network adapter name is different in these desktops. So this is what I have been using:

@ECHO OFF

set vardns1=XX.XX.XX.X
set vardns2=XX.XX.XX.X


ECHO Setting Primary DNS
netsh int ip set dns name = "Ethernet" source = static addr = %vardns1%

ECHO Setting Secondary DNS
netsh int ip add dns name = "Ethernet" addr = %vardns2%

ipconfig /flushdns

exit

And then I have 3 more that are identical, except the Network adapter has a different name. The scripts keep failing, but if I run the same one multiple times, it will usually pass after 3 times. Same creds and everything. What would cause this? And is there a way to have 1 script cover multiple network adapter names?

0 REPLIES 0