(imported topic written by SystemAdmin)
I created a custom task to “deploy” OpenDNS, which really only entails changing the dns server of our machines. Anyway I figured I’d post it here for you to enjoy. FYI The more or less duplicate netsh command is just for kicks, and the regset is also unnecessary.
Relevance:
(name of operating system as lowercase =
"winxp" OR name of operating system as lowercase =
"winvista" OR name of operating system as lowercase =
"win7") AND not (exists addresses whose (it as string =
"208.67.222.222") of dns servers of network AND exists addresses whose (it as string =
"208.67.220.220") of dns servers of network)
Action:
// Change DNS Server //
regset "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]" "NameServer"="208.67.222.222 208.67.220.220"
regset "[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]"
"DhcpNameServer"="208.67.222.222 208.67.220.220"
// Script 1 if Vista or Win7 //
if
{(name of operating system =
"WinVista") or (name of operating system =
"Win7")
}
delete __createfile
createfile until END_CREATE
@echo off
netsh interface ip add dnsserver "{name of connection whose (status of it = (connection status connected)) of network}" 208.67.222.222
netsh interface ip add dnsserver "{friendly name of adapters whose (cidr string of it = wake on lan subnet cidr string) of network}" 208.67.222.222
ipconfig /flushdns
END_CREATE
delete dns1.bat
move __createfile dns1.bat
waithidden dns1.bat
endif
// Script 2 for everyone and WinXP //
delete __createfile
createfile until END_CREATE
@echo off
netsh interface ip add dnsserver "local" 208.67.222.222 index=1
netsh interface ip add dnsserver "local" 208.67.220.220 index=2
netsh interface ip add dnsserver "Local Area Connection" 208.67.222.222 index=1
netsh interface ip add dnsserver "Local Area Connection" 208.67.220.220 index=2
netsh interface ip add dnsserver "Local Area Connection 1" 208.67.222.222 index=1
netsh interface ip add dnsserver "Local Area Connection 1" 208.67.220.220 index=2
netsh interface ip add dnsserver "Local Area Connection 2" 208.67.222.222 index=1
netsh interface ip add dnsserver "Local Area Connection 2" 208.67.220.220 index=2
netsh interface ip add dnsserver "Wireless Network Connection" 208.67.222.222 index=1
netsh interface ip add dnsserver "Wireless Network Connection" 208.67.220.220 index=2
ipconfig /flushdns
END_CREATE
// Run script
delete dns2.bat
move __createfile dns2.bat
waithidden dns2.bat