Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sometimes DHCP, sometimes static 3

Status
Not open for further replies.

Medic42

MIS
Mar 13, 2002
15
0
0
US
I'll quickly get to the point.
In my office I use my laptop with Static address. When I go into the city and pickup on the local Huddle House WIFI, I need to change to DHCP. Does anyone know of a script or program that will help me do this with only a click of the mouse? I do this daily and get tired of having to put the info back into the network properties when I get back to the office. No option of running DHCP at office, I need to put the static back in. Help!!!

Thanks Alan
 
First thought is you could do this one of two ways.

First way would be in your TCP/IP settings, set it to obtain IP under the general tab and then statically set your information under the alternate configuration tab.
Since you won't get an IP address from a DHCP server, it should use the alternate info you supply under the other tab.

Second way would be just to setup a different profile on the machine for "out of office use". This way you have TCP/IP set to static under one profile and obtain under the other profile.

Hope that helps.
 
You could write a couple of VBscripts to make the changes for you. Check out the VBScript Forum's FAQ page.


--
The stagehand's axiom: "Never lift what you can drag, never drag what you can roll, never roll what you can leave.
 
Thanks guys. I think I have it licked. I wrote a couple of batch files that seem to work ok.
 
Would you mind posting your batch files? That would be handy...


--
The stagehand's axiom: "Never lift what you can drag, never drag what you can roll, never roll what you can leave.
 
These worked on a Vista and an XP Pro laptop.

First batch file *****Static Batch*****
@ECHO OFF


ECHO STATIC
ECHO ____________________
ECHO
ECHO CURRENT CONFIGURATION:::
netsh interface ip show config
ECHO ____________________
ECHO
ECHO CHANGING CONFIGURATION:::



netsh interface ip set address name="Wireless Network Connection" source=static addr=10.150.87.107 mask=255.255.224.0 gateway=10.150.87.1 1
netsh interface ip set dns name="Wireless Network Connection" source=static addr=10.120.132.51
netsh interface ip add dns name="Wireless Network Connection" addr=10.120.132.52 index=2



ECHO ____________________
ECHO
ECHO NEW CONFIGURATION:::
netsh interface ip show config
ECHO ____________________


PAUSE
CLR
EXIT


Second Batch File *****DHCP Batch*****
@ECHO OFF


ECHO DHCP
ECHO ____________________
ECHO
ECHO CURRENT CONFIGURATION:::
netsh interface ip show config
ECHO ____________________
ECHO
ECHO CHANGING CONFIGURATION:::



netsh interface ip set address name="Wireless Network Connection" dhcp
netsh interface ip set dns name="Wireless Network Connection" dhcp



ECHO ____________________
ECHO
ECHO NEW CONFIGURATION:::
netsh interface ip show config
ECHO ____________________


PAUSE
CLS
EXIT
 
Cool. Thanks, and have a star.

--
The stagehand's axiom: "Never lift what you can drag, never drag what you can roll, never roll what you can leave.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top