JSI Tip 3511. How can I change all my computer's DNS Server addresses using a batch file?
March 25, 2001
If you specifically configured the DNS Server address on your computers, and need to change its' IP address, you do NOT have to visit each of clients to effect the change.
The DNS server address is stored in the registry in the NameServer value name, a simple string data type, at or below the following key:
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipparameters
Using Regfind.exe, which I first documented in tip 1084, from either the Windows NT 4.0 Resource Kit Supplement or the Windows 2000 Resource Kit Supplement, you can create a batch file to change it. The batch file would contain one line for each remote computer that has a DNS Server IP address specifically configured. It can also contain a line for the local workstation that you run the batch from:
@echo offREM Local computerregfind -p HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipparameters "Old DNS IP" -r "New DNS IP"REM Remote computersregfind -m \computer1 -p HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipparameters "Old DNS IP" -r "New DNS IP"regfind -m \computer2 -p HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipparameters "Old DNS IP" -r "New DNS IP"regfind -m \computer3 -p HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipparameters "Old DNS IP" -r "New DNS IP"
'Old DNS IP' and 'New DNS IP' are dotted decimal notation, like 198.192.0.1
About the Author
You May Also Like