Silently re-connect to already mapped network drive?
We have an environment where there are several users that work out of the office on a regular basis. All use Windows 7 32-bit Enterprise OS. I would like to create a Scheduled Task to kick off a series of events when our VPN client is successfully connected: VPN is established, thus initializing the TaskSilently reconnect the disconnected, but already mapped, P: drive network share(..other steps) It seems simple, but I'm not sure how to do #2. I know that I can use "net use" to re-map the drive, but I don't want to re-map it since it's already there. I just want to establish the connection. Usually, users need to double-click the P: drive in order to get it to reconnect. It's a simple step and seems like it should be easy enough to automate, but I'm not sure how without re-mapping the share. Ideas?
March 13th, 2012 1:02pm

Executing Scripts on VPN Connection This can be achieved by creating a task in task sceduler to run on vpn connection (using event id). Type the below command in command prompt after replacing the data accordingly schtasks /create /F /TN "abc" /TR "C:\test.bat" /SC ONEVENT /EC Application /MO " *[System[(Level=4 or Level=0) and (EventID=20225)]] and *[EventData[Data='VPN NAME']]" Replace abc by any name, just to identify your task. c:\test.bat should be replaced by path to your batch file which you need to run on vpn connectionVPN Name should be replaced by the name of the vpn connection, after connection of which you wish to execute the batch file above. Once you have created the task, you can view the task in task scheduler @ Windows Control Panel > Administrative Tools > Task Sceduler Reconnecting the Share Either of these 3 methods should work this out Have a batch file to open an explorer window minimized to the share path and then auto close it based on the Window Title using taskillSimply change drive to the mapped drive letter in batch file (works for me on my office vpn)Try using the command, replacing z by drive letter mapped and \\server\share by share path net use z: \\server\share 2> nul For option - 2, use these commands in batch file Start /min explorer x:\ timeout 3 /nobreak Taskkill /fi "windowtitle" here replace X with the share drive letter and replace windowtitle with the title of the window when you open the share when it is connected Reference Links: Answered Post By Northwind Traders on http://social.technet.microsoft.com/Forums/en-US/w7itpronetworking/thread/4c2bea2a-5c06-4ef0-83c3-85e1c27a7dad/TaskScheduler Task Execution on VPN connect event from this article - http://simpleverse.wordpress.com/2010/10/06/add-routes-on-vpn-connect-with-powershell-and-task-scheduler/ Regards Ashok J Prakash | My Blog If a post solved your problem, click Mark as Answer on the post. If a post helped you, click "Vote As Helpful" on the left side of post.
Free Windows Admin Tool Kit Click here and download it now
March 13th, 2012 3:13pm

Jus checking, did this work out for you ?Regards Ashok J Prakash If a post solved your problem, click Mark as Answer on the post. If a post helped you, click "Vote As Helpful" on the left side of post.
March 14th, 2012 3:07pm

Thanks for your reply! The problem I'm running into now is the VPN client we use is SonicWall and it doesn't appear that any events are added to the event log when a connection is established, so I'm just trying to find out how to trigger the event. I can see when the service starts in the application log, but not when the actual connection is established. Sonicwall has its own logging, but I'm not sure if Windows sees any of it. Thanks for the batch file informaiton - very helpful!
Free Windows Admin Tool Kit Click here and download it now
March 28th, 2012 4:39pm

SonicWall is a 3rd Party software, windows cannot catch events of what you are expecting in this scenario. I guess SonicWall Support Forums / Technical Team would be a better place to find some script to catch the sonicwall connection event. Rest to do the actions on Windows side, you can use the above post :-)Regards Ashok J Prakash If a post solved your problem, click Mark as Answer on the post. If a post helped you, click "Vote As Helpful" on the left side of post.
March 28th, 2012 5:00pm

I figured out how to kick off the batch file using SonicWall. I want to use this batch file, but I am having problems figuring out what the WINDOWTITLE should be: Start /min explorer x:\ timeout 3 /nobreak Taskkill /fi "windowtitle" I've found that I actually need the syntax: Taskkill /fi "WINDOWTITLE eq (window title)" But I've tried everything I can think of for the window title and I get the following error (just testing in cmd to start): INFO: No tasks running with the specified criteria. How do I find the proper window title to use in that batch file? EDIT: I tried running a tasklist /v to see what the explorer task window title is, and there were no explorer.exe tasks even listed. Ran CMD as administrator and tried again, got one explorer.exe task but the window title was "N/A" - I have two explorer windows open currently.
Free Windows Admin Tool Kit Click here and download it now
March 28th, 2012 7:06pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics