![]() Next, the task TASK is activated in the Task Scheduler. ![]() If the batch file was not “ Run as administrator”, an error message is displayed and the batch file terminates. The administrative rights are required for the activation of tasks in Task Scheduler. In the next step, the batch file checks if it was started with administrative rights. Using these variables, you can configure multiple batch files for several VPNs. In lines 4 and 5, the two variables VPN and TASK identify the VPN connection and the task of the Task Scheduler and must be changed to your individual names accordingly. Run script as administrator.ġ4 15 schtasks /Change /TN % TASK% /ENABLEġ6 runas /trustlevel:0x20000 " rasdial.exe \"%VPN%\"" The batch file " Enable My Connection (VPN).cmd" activates the task for automatic reconnection and then connects the VPN:Ģ 3 :: REMARKS: Don't use double quotes for VPN name as they've to be escaped by back slashes for runas 4 set VPN=My Connection (VPN)ĥ set TASK= " My Connection (VPN) Redial" 6 7 :: Check for administrative rights 8 net session >nul 2>
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |