script/program to enter ip/dns settings

leeroy

Gawd
Joined
Apr 14, 2004
Messages
578
i build many machiens per day, and i activate them via the on bord lan via my network.
the thing is i have to enter all the ip addresses and dns settings per machine just to avtibate it and then put it back to automatic .... it gets quite frustrating havign to enter 50 ip addresses on 50 machines

so is there a prog or a script i can do to run so it can fill in the values for me?

something like mobile net switch or novell like so i can apply different settings for different network ... but obviously i cant be install mobile net switch onto these freshly built machines too
 
yep and then i usually put it back to automatically which is generally a pain. thats why i dont wana install any other sw then uninstall since its going to customers
 
I use this. Make a 2 different batch files, static.bat and dhcp.bat

To set a static address, this is the syntax:

Code:
netsh interface ip set address [ip netmask gateway metric]

So, for example, this will set the connection called "Local Area Connection" (default in XP) to 192.168.1.2 with a class C subnet mask, 192.168.1.1 as your gateway, and a metric of 1 (you almost always want a metric of 1):

Code:
netsh interface ip set address "Local Area Connection" 192.168.1.2 255.255.255.0 192.168.1.1 1

To set it back to dhcp:

Code:
netsh interface ip set address "Local Area Connection" dhcp

I absoltuely love the netsh command. Take a look at the help on it to see what it can do.

Edit: WIth a little bit of batch programming, you could easily make this script take an argument. You could do something like "static 2" and have it set the addy to 192.168.1.2 or you could feed it the whole address as an argument, like "static 10.1.3.6". You could toss these bat files into the Windows directory on these machines when your build them up, so they're in the path. You could clean them up when you're done or just leave them - the customer won't know or care that you're leaving 2 tiny batch files on the machine.
 
Back
Top