I found an excellent write up on Technet.
»
social.technet.microsoft ··· indows-8How to setup a Scheduled Task to Trigger on a VPN Disconnect
1. Click Windows8 Start and type Schedule Task (open it under Settings)
2. Click Create Task
3. Apply the following settings in the specified Tabs (italics describes each setting)
General Tab
Name: VPN Redial
For descriptive use, you can use any name you want like My Company VPN Redial....whatever.....
Select: Run whether user is logged on or not
Provided you have a password associated to your login account, this option will prevent the dos window from opening everytime the job runs. If you don't have a password, leave it and see the notes below these steps.
Triggers Tab
Click New button
To create a new trigger we will use to activate the job when the VPN connect disconnects
Begin the task: On an Event
The job will be triggered by an Application event log entry
Select: Custom
Custom gives us the flexibility of creating a more detailed query
Click New Event Filter... button
Here is where we build the query for the trigger
Click the XML tab
This tab allows us to write our own query (even more flexible)
Check Edit query manually
To start a manual edit
Copy the following query
This query will trigger on an Application Event for RasClient with an EventID of 20226 and error codes 829 (Remote Disconnect), 629 (Client Disconnect). Copy from and including to
*[System[Provider[@Name='RasClient'] and (EventID=20226)]] and *[EventData[Data[4]='829' or '629']]
Click OK
Ensure Enabled is checked
Check it if it's not checked to make sure the job will be enabled
Click Ok
Actions Tab
Click New
To create an action to be performed when the job is triggered
Action: Start a program
Selection this option will allow us to start rasdial to reestablish the VPN connection
Program/script: rasdial
Should already be in path so just enter rasdial command
Add arguments (optional): "VPN Name" username password
VPN name is the name you defined for your dialup connection. Example, when you click the network icon in the system tray, the name that's listed for your VPN, make sure you enter it in exactly as displayed. Following the connect would be your username and password. Example, "MY VPN Connection" username password
Click Ok
Conditions Tab (not required unless you are using a laptop)
Uncheck: Stop if the computer switches to battery power
Settings TAB
Enable: If the task fails, restart every: 1 minute
In case there is a temporary issue re-establishing the VPN connection. You can specify whatever value you want instead of 1 minute
Attempt to restart up to: 7 times
Again in case there is a temporary issue re-establishing the VPN connection. You can specify whatever value you want instead of 7 times
Click Ok