Monday, May 10, 2010

Scripting: Adding DNS Servers to a network connection

Netsh is used to add DNS servers to a network interface. To set the primary DNS server, run the command:

netsh interface ip set dnsserver "Local Area Connection" static 1.2.3.4

This only works for primary DNS servers however. To add additional DNS servers, enter the following command:


netsh interface ip add dnsserver "Local Area Connection" 1.2.3.7

Of course then you might like to register the connection in DNS with the following command:
ipconfig /registerdns

No comments:

Post a Comment