Sunday, October 09, 2005 12:30 AM bart

Netsh madness

I just tried to make some kind of cool script to change my networking settings in Windows Server 2003 according to the network where I'm connected (home office <-> office in Ghent). In both places I have to use a static IP, so I tried to do something with the netsh command. Setting the IP is easy:

netsh interface ip>set address name="Local Area Connection" static 192.168.0.101 255.255.255.0 192.168.0.1 1
Ok.

However, setting the DNS to the loopback address (when I'm at home, in my domain environment with DNS forwarding etc) doesn't work :-(...

netsh interface ip>set dns "Local Area Connection" static 127.0.0.1 primary
127.0.0.1 is not an acceptable value for addr.

Why, for godsake? Any suggestions are welcome :-).

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Filed under:

Comments

# re: Netsh madness

Monday, October 17, 2005 7:30 PM by bart

For your home configuration, why not just set the DNS value to whatever static IP you set for your machine?

You can bundle up NETSH commands in a script file and run the script to batch all these commands together.

# re: Netsh madness

Monday, October 17, 2005 11:05 PM by bart

I know, but I'd like to see the loopback working fine :-). Nevertheless, the WMI-based code works fine (see http://community.bartdesmet.net/blogs/bart/archive/2005/10/09/3600.aspx).