Changing DNS suffix search order from the command line

Quickie: To change the dns suffix search order from the command line, run the following
reg add HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters /v SearchList /t REG_SZ /f /d foo.com,bar.com

ipconfig /registerdns

If you have to change it on 37 machines, make a list of machines in machines.txt and run this...

for /F %i in (machines.txt) do reg add \\%i\HKLM\SYSTEM\CurrentControlSet\services\Tcpip\Parameters /v SearchList /t REG_SZ /f /d foo.com,bar.com

for /F %i in (machines.txt) do psexec \\%i c:\windows\system32\ipconfig.exe /registerdns
Magic.

Comments