If I run the same command on 10 machines, most will fail. Maybe 1 or 2 will pass. Then I run the exact same command again, and 2-3 more will pass. I run it again and usually the rest will pass. If I run a deployment on 100-200 machines at once, they all seem to fail. All the same commands and creds used. Here is what I used:
@ECHO OFF
set vardns1=XX.XX.XX.XX
set vardns2=XX.XX.XX.XX
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