How to check if the RAS-session is established?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
dose
Newbie
Posts: 2
Joined: Wed Apr 11, 2007 5:51 am

How to check if the RAS-session is established?

Post by dose » Wed Apr 11, 2007 6:01 am

I want to check within my script if the system (Win 2000) is online (a VPN-Connection is established).
With rasphone it is easy to establish the VPN, I tried serveral things to verify if the system is online. None of same worked well.

Do you know a solution? I don't want to do this via screen-dumping and graphical analysis, if possible.
It seems if the VPN Connection is established there is no special window regarding the VPN-Connection.

Thank you for your idear
dose

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Apr 11, 2007 1:30 pm

I tried serveral things to verify if the system is online. None of same worked well.
Not much info there for someone trying to assist you. What have you tried?


I don't do VPN so I have no way to check this. I would think that after your connection is established there are files available that do not exist on your client computer. You could put IfFileExists> in a loop and continue when the file is found.

Label>CheckConnection
IfFileExists>V:\VPNConnectionTest.txt,ConnectionMade
Wait>1
Goto>CheckConnection
Label>ConnectionMade

dose
Newbie
Posts: 2
Joined: Wed Apr 11, 2007 5:51 am

Post by dose » Wed Apr 11, 2007 6:29 pm

The Microsoft VPN Client is handled in windows like a usual Dial-In Connection (for exampel with pppoe, modem or isdn).

I'm sorry but there is no special file existing if the connection is established.

The only thing I recognized is, that if the connection is up the command-line programm "rasdial" shows:
Connected with
VPN-Connection-name
command successfull finished

or if not connected shows:
no connection
command successfull finished

But how can I handle this output from an execute-command?

greethings
dose

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Apr 11, 2007 7:35 pm

If this is a command line program, perhaps you can use the DOS screen text acquisition technique discussed in this thread then parse the results looking for "command successfull finished"

Just throwing out ideas here... anyone who has known solution feel free to join in.

User avatar
Djek
Pro Scripter
Posts: 147
Joined: Sat Feb 05, 2005 11:35 pm
Location: Holland
Contact:

Post by Djek » Wed Apr 11, 2007 7:41 pm

hey Dose,
try this, I use the output. If its more then 2 lines, there a connection.
Works for me!

let>RP_WINDOWMODE=0
DeleteFile>c:\rasdial.txt
Run Program>cmd /c rasdial >c:\rasdial.txt
wait>0.5
Let>k=1
Label>start
ReadLn>c:\rasdial.txt,k,line
If>line=##EOF##,finish
rem Message>line
Let>k=k+1
Goto>start
Label>finish
if>k>3
MessageModal>Connection established
endif

hopes this helps,
Djek

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts