Wednesday, March 16, 2011

Windows 7 Task/Logoff Problem

I use a VPN on my laptop. I have created a task to launch the VPN client and connect upon login and successful internet connection under any user. There are 2 users on the box - myself (administrator) and my gf (standard user).



My problem is I need to find a way to close the program / kill the VPN process upon the locking of our user accounts (and closing of the lid). Problem being that if my gf starts the machine and logs in and closes the lid when she's done (effectively locking her user account), I can't connect with the VPN under my user account because the process is running under her and my subscription allows for one connection at a time. If I can kill the process upon a user locking, the scheduled task will start the VPN the next time either one of us logs in.



"Logoff" is not an option under Power Management upon closing the lid - sleep and hibernate are not going to help me, and I don't want to shut it down every time the lid closes. Any ideas?

Reply 1 : Windows 7 Task/Logoff Problem

I don't think there's a way to edit the power settings that way. My suggestion is to change your plan settings so that your display shuts down after "x" amount of time of inactivity. That might be the closest solution.



-- Ryan

Windows Outreach Team

Reply 2 : Windows 7 Task/Logoff Problem

You might be able to do it with another scheduled task. Looking at the task creation, for the trigger, you can choose "On workstation lock". If you can close the VPN software using a command line, you could create a task to do this. Or the trigger could be an event such as going into standby.



The other thought is why do you need to start the VPN software? If the gf was connected and you switch to your account, the connection should still be running and you should have access. In this case, you would need to prevent the VPN program from starting if it is already running and connected. Or does locking the account log her out of the VPN but not close the VPN program?

Reply 3 : Windows 7 Task/Logoff Problem


Quote:








Originally Posted by davidfor
View Post

You might be able to do it with another scheduled task. Looking at the task creation, for the trigger, you can choose "On workstation lock". If you can close the VPN software using a command line, you could create a task to do this. Or the trigger could be an event such as going into standby.



The other thought is why do you need to start the VPN software? If the gf was connected and you switch to your account, the connection should still be running and you should have access. In this case, you would need to prevent the VPN program from starting if it is already running and connected. Or does locking the account log her out of the VPN but not close the VPN program?



Do you have examples of the specific command I could use for this task? I'm not familiar with Windows commands/scripts. In regards to why I have to start the VPN software, each user opens their own session - if it's running under my user and I have her switch user, it will need to run a new session but it wont let her because my connection is still live. Additionally, the other user doesn't have the ability to switch server locations or alter other configs in the client if it's running under another.

Reply 4 : Windows 7 Task/Logoff Problem


Quote:








Originally Posted by GLBL WMR
View Post

Do you have examples of the specific command I could use for this task? I'm not familiar with Windows commands/scripts.



I haven't done this on Windows for a while and had to look it up. So, have a read of How to kill hanged program from command line [ Windows ]

Reply 5 : Windows 7 Task/Logoff Problem

We solved this very issue at work, not VPN, but another service we needed.



It's quite simple when you think about it.

The scheduled task you start the VPN with needs to kill any prior running processes hogging the license.



Write small batch file that first kills the VPN task, like this

TASKKILL /T /F /IM vpnprogram.exe



then starts it again using



START "fullpathvpnprogram.exe"



The trigger could be:

"On local connection to any user"

"On workstation unlock of any user"

"At log on of any user"



Just a suggestion



You could also make another batch file with just the first line to stop vpn from running.

"On workstation lock of any user"

"on local disconnect from any user session"



That would kill it if one user let's the machine go idle or locks the desktop.

If the user logs off the task should be killed anyway right?

Reply 6 : Windows 7 Task/Logoff Problem

and of course run the .bat files as scheduled tasks

No comments:

Post a Comment