Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been trying for hours to find any info on how to reconnect to a PPTP VPN automatically. In Windows 7 there was an option to auto reconnect and how many redial attempts etc.

I can not find that in Windows 8.

Have they removed it? Are they going to add this functionality? I have to have my vpn connected for long periods unattended. This is a deal breaker for me I will be going back to Windows 7 if I can not find a solution.

share|improve this question

I too faced similar issue and hence coded a small tool in c# to provide redial functionality to dial up connection. You can download and use this tool from here Windows 8 Redialer

share|improve this answer

See the proposed answer here -

In brief:

  1. Using Task Scheduler, add a scheduled task.
  2. Add two triggers for the scheduled task. One using the advanced XML query <QueryList> <Query Id="0" Path="Application"> <Select Path="Application">*[System[Provider[@Name='RasClient'] and (EventID=20226)]] and *[EventData[Data[4]='829' or '629']]</Select> </Query> </QueryList>

    and the other triggering on event log: Microsoft-Windows-NetworkProfile/Operational, source: NetworkProfile, Event ID: 10000

  3. Add one action, to run "rasdial.exe" with parameters vpn-name username password
share|improve this answer
Please include the essential parts of the answer here, and provide the link only for reference. – slhck May 19 '13 at 8:42
And if you are using the laptop, do NOT forget to clear the checkbox [X] Start the task only if the computer is on the AC power in task Conditions tab. – miroxlav May 20 '14 at 20:04
I wouldn't recommend this approach as it requires storing your password in plaintext (xml files for task scheduler). – Neil Barnwell Jun 3 '15 at 12:58

I disagree with Owen’s answer above because using the "not equal to" (!=) command does not seem to work when comparing a value to a EventData element. The query returned zero results.

I did however come up with an answer that finds all events with an EventID of 20226 (RAS Connection Termination) or an EventID of 20227 (RAS Connection failed on Connection)

The trick is to then suppress those results that have an EventID=20226 with a data element of 631 (The port was disconnected by user)

So basically you grab all the 20226 and 20227 events, and then, from that list, reject the 20226 results with an error of 631

This works well since there are about 150 error codes associated with rasClient ( and the only one I don’t want to initiate a restart is when I disconnect the connection (631).

Here is the query I came up with. Testing it in the event viewer; it seems to meet all the necessary criteria.

  <Query Id="0" Path="Application">
    <Select Path="Application">*[System[Provider[@Name='RasClient'] and (EventID=20226 or EventID=20227)]] </Select>
    <Suppress Path="Application">*[System[Provider[@Name='RasClient'] and (Level=4 or Level=0) and (EventID=20226)]]and *[EventData[Data[4]='631']]

Using this as a trigger for action Start a program C:\Windows\System32\rasdial.exe “” UserID Password will start the reconnection process whenever the connection failes.

It is not a “perfect” solution as it does rely on storing your VPN UserID and Password in plain text, but I figure if someone has reached that deep into my computer, I have bigger troubles then worrying about one VPN password.

share|improve this answer

I'll comment abount an answer above here:

But What If internet can't be reconnected immediately? e.g. it disconnected for some time - then this task would just fail once and stop - you'll come back to computer and see no internet (that's how it was for me)

. I'm checking error codes because I don't want the job to be reconnected if I purposely disconnect the VPN which generates a 631 code under Event ID 20226.

Then why doesn't that guy just exclude code 631 instead of checking for every possible code except 631?

so I fixed it a bit to also reconnect on event id 20227 (failed dial attempt) and to just exclude self-made disconnects:

  <Query Id="0" Path="Application">
    <Select Path="Application">*[System[Provider[@Name='RasClient'] and (EventID=20226 or EventID=20227)]] and *[EventData[Data[4]!='631']]</Select>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.