configure DNS remotely. NETSH -r MEH

It must be that I need a nap, but I couldn't get netsh -r to work. I wanted to create a batch script to set the DNS for all windows servers in a domain. Alas I gave in for what I knew would work...

Be sure you got sysinternals installed...

Let's see what the current setting are:
psexec \\ServerName ipconfig /all

working example:
-----------------------------------------------------------------
Windows IP Configuration

Host Name . . . . . . . . . . . . : ServerName
Primary Dns Suffix . . . . . . . : BOBMIHADA.COM
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : BOBMIHADA.COM

Ethernet adapter Private:

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
Physical Address. . . . . . . . . : 00-00-00-00-00-00
DHCP Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.101.71
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :192.168.101.1
DNS Servers . . . . . . . . . . . : 192.168.101.10
192.168.101.51

Ethernet adapter Public:

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection #2
Physical Address. . . . . . . . . : 00-00-00-00-00-00
DHCP Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.2.100
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.2.1
DNS Servers . . . . . . . . . . . : 192.168.2.10
192.168.2.54
ipconfig exited on ServerName with error code 0.


Now let's proceed with changing the DNS settings on the Private Interface
--------------------------------------------------------------------------------

psexec \\ServerName netsh interface ip set dns "Private" source=static addr=192.168.101.69
psexec \\ServerName netsh interface ip add dns "Private" 192.168.101.79

Let's see what the NEW current setting are:
psexec \\ServerName ipconfig /all

-----------------------------------------------------------------
Windows IP Configuration

Host Name . . . . . . . . . . . . : ServerName
Primary Dns Suffix . . . . . . . : BOBMIHADA.COM
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : BOBMIHADA.COM

Ethernet adapter Private:

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
Physical Address. . . . . . . . . : 00-00-00-00-00-00
DHCP Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.101.71
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :192.168.101.1
DNS Servers . . . . . . . . . . . : 192.168.101.69
192.168.101.79

Ethernet adapter Public:

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection #2
Physical Address. . . . . . . . . : 00-00-00-00-00-00
DHCP Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.2.100
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.2.1
DNS Servers . . . . . . . . . . . : 192.168.2.10
192.168.2.54
ipconfig exited on ServerName with error code 0.

ENJOY!

Comments :

0 comments to “configure DNS remotely. NETSH -r MEH”