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

Help writing a VBScript to run a dialup connection

Status
Not open for further replies.

GregNVMC

IS-IT--Management
Jul 8, 2003
19
GB
Hi,

I am a total scripting newbie. I know nothing about this stuff, so please be gentle ;-)

I use a dialup connection on my home PC. Problem is that the ISP disconnects every so often.

I'd like to write a script that detects if a dialup connection is running, and automatically reconnects it if it drops. What I'd also like to do is email the IP address that it picks up when it reconnects again. This will enable me to VNC back to the box again after the reconnect.

Please help me as I've looked at loads of sample scripts and I don't understand what I'm looking at?

Kindest Regards,

Greg
 
Try this as a start...
It's something I did for a client of mine

-

CoachHog

/////////// Code Start ///////////////
rem -----------------------------------------------------------------------------
rem RASWorks - Keep RAS Connection Alive Batch File
rem -----------------------------------------------------------------------------
rem Filename : rasworks.bat
rem -----------------------------------------------------------------------------
rem Created by: Coach/TeamHog
rem Purpose : Keeps a RAS Connection ALIVE
rem If the connection breaks it will attempt to re-connect
rem -----------------------------------------------------------------------------
rem Copyright © 2004, TeamHog
rem -----------------------------------------------------------------------------
@echo off
@cls
SetLocal
( Set /P RAS_con=Enter the RAS Connection Name ? %)
( Set /P RAS_usr=Enter the RAS Connection User Name, esc ? %)
( Set /P RAS_pwd=Enter the RAS Connection Password, 99999 + SecurityNumber ? %)
:Online_check
@cls
@echo off
@echo RASWorks@
@echo Copyright, 2004 ESC
@echo Press Ctrl-C to Stop
echo.
rem -------- Note ------------
rem ---- We have to force the system path ----
rem ---- because the MKS Toolkit, aka Nutcracker ----
rem ---- supercedes the find command in it's path ----
Rasdial | %systemroot%\system32\Find /V /N "" | FindStr /R "^\[3\]" >null && (
Echo %DATE% %TIME% -- Still Online. Delaying 60s...
Ping -n 61 localhost > NUL
Goto Online_check)

Echo %DATE% %TIME% -- Offline. Reconnecting To "%RAS_con%"...
Rasdial "%RAS_con%" %RAS_usr% %RAS_pwd% && Goto Online_check
Echo %DATE% %TIME% -- Error Connecting to "%RAS_con%".
Echo You May Have to Update the Secure Password
EndLocal

////// Code End /////////////
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top