Run a Exe after Successful VPN Connect


I have a exe that needs to be executed automatically after every successful VPN connect. We all have Laptops here and we connect to the network thru VPN dial up. And I want one particular exe to run after every successful VPN connection. Cld anyone help me in achieving this? Its very urgent and I wld be very thankful to U all if this problem of mine is solved.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Where do you want this application to run?  On a server, or on the laptop?  Or does it matter?

What OS are you using, both server and laptop?

After a successful connection, what is the first activity by a laptop?  Is it, perhaps, authenticating to a tree or domain?  I HOPE you are forcing these VPN users to log in after establishing their connection, before allowing access to any network services.

You should be able to formulate a login script that runs conditionally when a user logs in through a VPN connection, that would execute your program.  It would be easiest, of course, to have it execute on the laptop in such a case.

There may be a way (I don't recall) to force execution of a program on a server from a client login script.  If there is a way, I'm sure another Expert here will give you appropriate advice.  Otherwise, there are ways to trigger execution based on various events, which could be caused by the login script.
IrfyyAuthor Commented:

I want the Application to run on the users Laptop. And this is very much necessary that the Appln runs on the users Laptop.

OS used is Win 2k.

Can we get help on which event can trigger this execution.

Or else, Experts cld U pls shower Ur thoughts on this so that it wld be helpfull for me?


If your users are authenticating as users on a Win2K server after making their VPN connection, they should be able to run a login script as part of their login to your domain.  

The login script would contain the command to run the executable.  It would go faster if the laptop already had the executable, but then you have to devise a way to keep the executable up-to-date on all the laptops.  A slow VPN link, especially if it's analog dialup, will make the launch of the program rather slow unless it does reside on the laptop.

Like I said, you should be able to make execution of the program conditional depending on whether the user is connected directly to the LAN or through the VPN.
SolarWinds® Network Configuration Manager (NCM)

SolarWinds® Network Configuration Manager brings structure and peace of mind to configuration management. Bulk config deployment, automatic backups, change detection, vulnerability assessments, and config change templates reduce the time needed for repetitive tasks.

otherwise create a batchfile that uses rasdial to establish the connection and then executes your application

RASDIAL /PHONEBOOK:phonebookfile
IrfyyAuthor Commented:

if U are talking abt putting this exe in the domain login script, then I wld like to tell U that this exe shld not execute on all domain users desktop. Well let me explain the scene first.

My Appln will be installed on some client desktops' startup folder so that irrespective of whether the user logs in using domain userid or not, the exe will be called on all logons.

So I shld make the exe execute when this user connects to VPN also. All the install details are available in Registry.

Hope the picture is clear now. I want this exe to be executed only on some client desktops who have installed my appln when they connect thu VPN.

Pls help.

And Chicagoan, what is the batch file U were talking abt? Will that serve my purpose now? Cld U pls elaborate?

That is why I am saying that this should be conditional on whether or not the user is logging in via VPN.

I know it can be done, but I have to leave for work for about 16 hours, so I will leave it up to the other Experts to help you figure out how.
Create a shortcut to the batch file and have the user use the batch file to connect.
You can use one rasdial isnatance to dial the isp and another to establish the vpn, if necessary.

rasdial /phonebook:isp
rasdial /phonebook:vpn

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IrfyyAuthor Commented:
Wht will this do? Execute my exe? How?
Someone out there should be able to answer your question after this fashion:

Using a similar example of how conditional execution within a NetWare login script works - you should be able to set an environment variable somehow that indicates that the login is through the VPN - this might be based on a test of the IP address range assigned.

This environment variable must be set prior to execution of the login script.  When the script hits the "if" statement that tests for the environment variable, it would either run the program if the environment variable indicates it is a VPN connection, or it will not run the program if the environment variable indicates that it is not a VPN connection.

That SHOULD be translatable into a similar process for your Windows login script, which is essentially a glorified DOS .BAT file..  

If it CAN'T be done, then that's yet another indication of the superiority of NetWare networks over Windows networks.  If it CAN be done, then I expect to see a post from another Expert explaining to you HOW to do what I just described.

If you don't get a comment from another Expert with how to do what I described in a Windows network environment, then perhaps you can use the information I provided to devise your own solution using the logic-flow I recommended.
Perhaps Chicagoan's comment and my comment can be combined to get a solution.  

The .bat file shortcut Chicagoan recommends could have a SET command in it to set a custom environment variable value that indicates that, since the BAT file was run to make the connection via VPN, the connection is a VPN connection, which then would trigger execution of the program via an IF conditional statement in your login script.

Make more sense now?  Anyone else have more details to help Irfyy get this done?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.