The Code
Here's an example of how to change the DNS server
entry on all servers in your organization. First, create a batch file
called Regchange2.bat with the following syntax:
regfind -m \\%1 -p HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\parameters "OLDIP" -r "NEWIP"
You will obviously want to replace OLDIP
with the old DNS server IP and replace
NEWIP with the new DNS server IP.
Now, create a second batch file called
regchange1.bat with the following syntax:
for /F %%A in (servers.txt) do (call regchange2.bat %%A)
This searches the servers.txt file
for computer names and passes them to the
regchange2.bat file as a command-line argument.
Now you need to create a list file for your batch files to use.
Create a listing of servers that need to have their DNS
IP's changed and save that list as
servers.txt. An SMS report or a copy/paste from
the server manager will suffice, or you can create the file manually
if you like.