Need to deploy a scheduled task to run a script only when a certain event ID occurs. The script must use LOGGED ON user credentials, not SYSTEM. The purpose of this is to make something map drives after a VPN connection is connected.
I already have a successful script that creates a scheduled task and gets trigged once the VPN connection has been established (event ID 20267). The following script will create a scheduled task and only run after VPN connection has been enabled. The task runs another script (file location embedded in the file.xml)
schtasks /delete /f /tn "TASK NAME"
schtasks /create /tn "TASK NAME" /ru SYSTEM /xml
\\server\folder\file.xml
The problem with the above script is if it will try and map network drives for SYSTEM not current user.
I've tried the replacing /ru SYSTEM with %username% but it insist that I have a password. I obviously do not want the password to be visible in the batch file and the password will be different for everyone. I also do not want the user to have to type the password in every time after they connect the VPN.
Must be a way to do this...can anyone help?? Thanks
- Edited by Kelvin.uk Wednesday, January 28, 2015 6:47 PM