Avatar
By Pavel Shchegolevatykh / January 30, 2013

PPPoE automation

In my previous post I showed how to open PPPoE connection automatically at Windows startup. However there were still some issues. One of them is to find a way to keep this connection alive. After doing some research I came up with two ideas.

Method 1 - Scheduled task

1. Open Task Scheduler window from the control panel or type taskschd.msc in Run Menu and create a new task.

2. On General tab specify Name and Description. Also chose Run whether user is logged on or not option in order to run task in background.

3. On Triggers tab add a new trigger. Set Daily option and Repeat task every 5 minutes for a duration of Indefinitely.

4. On Actions tab add a new action. In Program/script text field type rasdial. In arguments specify your credentials: connection name, username and password separated by spaces. After that click OK in all windows.

Then Task Scheduler asks you to provide your PC user credentials in order to continue. Please do that and we are all done with task creation.

You can test it by running manually or just wait for five minutes to see if it works. One obvious drawback is that we can only specify no less than five minutes timeout to reconnect. Maybe for some reason you need less than that. A good thing that user doesn't feel anything - no frightening command prompt or other dialogs. It works just like any other background process.

Method 2 - Custom Windows Service

As I said before for some reason you might need polling interval to be less than five minutes. For this purpose I implemented a Windows Service application that is fully configurable. You can set polling timeout and your connection details. It uses rasdial process internally. Works seemlessly. No annoying popups. Internal timer triggers polling for specified connection. If are to change something in xml config file you should restart the service. This file is located in the service application folder (Program Files by default). After the installation in order to run the service you can either restart your PC or run it manually using windows Services manager (services.msc using Run command).

Download PPPoE dialer service installer
Source code

If you found this useful feel free to thank me in comments or share this post with others.