Question : IP Address Script At Windows XP Logon dialog

I have a laptop used on two LANs, one not DHCP on a Class A subnet and one running DHCP on a class C subnet.  I need/would like the user to establish the VPN connection to logon to the domain rather than using cached credentials and connecting later.  However, the current method I have for them changing IP address is a batch file they manually run from their start menu.

Is there any way I can set up a script so that it can be run either automatically or manually at startup/pre-logon so that the IP can be set?

(I'm thinking of the corporate iPass/Cisco VPN client scenarios I've been exposed to elsewhere - this is a small business situation with only Windows 2003 RRAS.)

Answer : IP Address Script At Windows XP Logon dialog

Another thought, and likely better. The following would assign the static address if no DHCP server is present, and use DHCP if one is present.

Echo off
CLS
rem force attempt to obtain DHCP address even if currently assigned static IP
netsh interface ip set address name = "Local Area Connection" source = dhcp
netsh interface ip set dns name = "Local Area Connection" source = dhcp
netsh interface ip set wins name = "Local Area Connection" source = dhcp

If Exist Result1.txt del Result1.txt
If Exist Result2.txt del Result2.txt
IPConfig >Result1.txt
For /F "tokens=2 delims=:" %%A IN ('Find /I "Address" Result1.txt') DO Echo %%A >Result2.txt
For /F "tokens=1 delims=." %%B IN (Result2.txt) DO SET SubNet=%%B
If %SubNet%==169 GoTo STATIC
GoTo DHCP

:STATIC
rem Echo Subnet is 3
rem enter your lines here for subnet x.x.10.x
netsh interface ip set address name = "Local Area Connection" source = static addr = 10 0.3.16  mask = 255.0.0.0
netsh interface ip set address name = "Local Area Connection" gateway = 10.0.0.254 gwmetric = 1
netsh interface ip set dns name = "Local Area Connection" source = static addr = 4.2.2.2
netsh interface ip add dns name = "Local Area Connection" addr = 4.2.2.3
GoTo END

:DHCP
rem Use currently assigned static IP
:END
Del Result1.txt
Del Result2.txt
Random Solutions  
 
programming4us programming4us