PDA

View Full Version : networking script



lord_fu
11-26-2005, 06:40 PM
Hello,
First off awesome site, I have been browsing here for the past few weeks untill I decided today to join and hopefully get some help with my first post!
I have a Sony Vaio laptop that I am constantly changing the ip address of because at school I use dhcp on my wireless connection or ethernet connection. Then when I get home where I have a small network I need my static ip back, and I have to go through the My Computer->Netowrk Connections ->Select my connection ->Properties ->TCP/IP->well you know the rest. I really don't mind all the clicking...I know I can create a faster shortcut...but what I want to do is create a script or batch file that can allow me to accomplish this by either passing options command line or hard coding them in.
The problem is is I have minimal experience with batch files, and I only today wrote my first windows "hello world" script:(, although I do have experience in other programming languages.
So I guess I was hoping for someone to point me in the right direction or possibly some examples?
Thank you.

lord_fu
11-26-2005, 10:39 PM
Hi, got it sorted out with this
http://www.pixelninjas.com/Forums/Default.aspx?g=posts&t=10

jdharm
11-26-2005, 10:54 PM
I've often wondered about this myself, but never enough to do more than a little cursory searching, which came up with nothing, of course. But since you brought it up I did a little digging and came up with some interesting stuff.

First, the "Alternative Configuration" tab in the TCP/IP setup. I never paid much attention to it before, but apparently it is for exactly the situation you mention. If you set up your manual configuration in the Alt Config tab and you go to a network and there is no DHCP server to be contacted then the system will fall back to this alternative setting. It worked exactly as advertised in a quick test here at home when I switched off the DHCP server on my router, but the timeout on the DHCP request failure is a real drag.

So I went off in search of a cure for that. That's when I ran across <font color=blue><a target="_blank" href=http://snipurl.com/k9d9>THIS INFO</a></font color=blue>. I believe this is just what you are looking for, too. I can't tell you how excited I was to find it. I love being able to automate tasks with little scripts like this, and this was one task that has eluded me for some time now.

FYI: The commands shown on the page didn't work as shown. But looking at the output of the interface dump file shows where some details that were missing from the commands shown needed to be.


BTW, welcome to the forums.

&lt;edit&gt;

Doh! I see you found it as I was composing this. Ah well, I'm glad we found a solution.

&lt;/edit&gt;

Josh
<a target="_blank" href=http://www.jdharm.com>www.jdharm.com</a><P ID="edit"><FONT class="small">Edited by jdharm on 11/26/05 22:58.</FONT></P>

lord_fu
11-27-2005, 04:28 PM
jdharm,

Thanks for the effort of even looking for a solution for me. Yes when I referred to shortcuts in my first post. The alternate tab was to what I was refering, and as you quickly noticed the timeout is horrible. That is why I wanted the fastest way which is exactly what we found. I hope you are as happy as I am with the results....!<P ID="edit"><FONT class="small">Edited by lord_fu on 11/27/05 16:29.</FONT></P>