Connect VPN Automatically

I created a server that needed to be connected to the VPN at all times. Here's three ways of doing it, but I used the last way - a scheduled task that repeatedly executes every 5 minutes after system start up, meaning if the VPN goes down and then up, it will still reconnect.

Application based triggering (Windows 8+):

  1. PowerShell: Add-VpnConnectionTriggerApplication [-Name] <string> –ApplicationID <String[]> -PassThru
    Source

Quick and Dirty (Windows XP+):

  1. Save credentials in VPN connection
  2. Drag a shortcut to the 'Startup' folder
    Source

Schedule a task to execute at System Startup

  1. Create a scheduled Task (I had it execute every 5 minutes after start indefinitely for auto-redial)
  2. Create batch script: rasdial "My VPN Connection" <username> <password>
    Source