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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Choose IP address/Default GW from list

Status
Not open for further replies.

ctrost

Technical User
Dec 1, 2006
78
US
I have a few remote users with laptops that visit 2 remote offices, as well as working from home. Both remote offices use static ip address info, while the home uses DHCP. I want to make the switch over as painless as possible. I would like to set up a vb script that will prompt the user to select between office 1, office 2 or the home dhcp connection, and set accordingly.

I found batch files that will work, they're just not as user friendly as i'd like

any help is greatly appreciated!
 
Why don't you post the batch file to see what it's doing?

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
OK, here it goes... stay with me on this.

The main batch file has a menu, that uses netsh, and calls settings from one of 3 different txt files that hold the ip settings for that particular menu choice (menu choices of Office 1, Office 2, or home) the 2 offices are static ip info, the home is DHCP. it works this way, but some of the users are confused by dos boxes and no mouse, so i'd like to do a vb script or something with buttons or radio buttons, etc

Here's the main batch file
+++++++++++++++++++++++++++++++++++++++++++
@echo off
title IP Configuration Batch File
setlocal
set OK=N



:again
set /p choice=Please enter 1[Office 1], 2[Office 2], 3[Home] or END ??
if /i [%choice%]==[END] endlocal&goto end
if [%choice%]==[] goto again
if [%choice%]==[1] goto 1
if [%choice%]==[2] goto 2
if [%choice%]==[3] goto 3
set /p xxx=wrong entry, press any key to exit.
endlocal
goto end



:1
echo NIC setting for Office 1 being configured.....
@netsh exec Office1.txt
set /p see=IP changed successfully to Office 1 Settings [9]see new setting [Enter]exit...
if [%see%]==[9] goto show
echo Ending IP Configuration
goto end



:2
echo NIC setting for Office 2 being configured.....
@netsh exec Office2.txt
set /p see=IP changed successfully to Office 2 Settings [9]see new setting [Enter]exit...
if [%see%]==[9] goto show
echo Ending IP Configuration
goto end



:3
echo NIC setting for Home being configured.....
@netsh exec Home.txt
set /p see=IP changed successfully to Home Settings [9]see new setting [Enter]exit...
if [%see%]==[9] goto show
echo Ending IP Configuration
goto end



:show
@netsh int ip show config



:end
@echo on
cls

++++++++++++++++++++++++++++++++++

Here's the config file (without specific ip addresses, obviously)that is used for Office1 and Office2 (they're both identical, asside from the actual ip addresses.) STATIC IP

++++++++++++++++++++++++++++++++++


# ----------------------------------
# Interface IP Configuration
# ----------------------------------
pushd interface ip


# Interface IP Configuration for "Local Area Connection"
set address name="Local Area Connection" source=static addr=xxx.xxxx.xx mask=xxx.xxx.xxx.xxx
set address name="Local Area Connection" gateway=xxx.xx.xx.x gwmetric=0
set dns name="Local Area Connection" source=static addr=xxx.xx.xx.xxx register=primary


popd
# End of interface IP configuration


++++++++++++++++++++++++++++++++++

Here's the home.txt config file (DHCP)

++++++++++++++++++++++++++++++++++

# ----------------------------------
# Interface IP Configuration
# ----------------------------------
pushd interface ip


# Interface IP Configuration for "Local Area Connection"
set address name="Local Area Connection" source=dhcp
set dns name="Local Area Connection" source=dhcp register=primary
set wins name="Local Area Connection" source=dhcp


popd
# End of interface IP configuration

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top