Configure Windows to Automatically connect to VPN by Windows Task Scheduler


1. Create the VPN connection

2. Write a batch file to connect to VPN

3. Create a scheduled task in Windows task scheduler that will kick off the batch file at Windows start up

Here are the steps in detail:

1. Create your VPN connection

I am not going to go through all the steps of creating a VPN connection in Windows. I assume that you would not be reading this post if you did not already know how to create a basic VPN connection. However there is a setting in the VPN connection that you will want to set. This setting is:

clip_image001

2. Create a VPN auto connect batch file.

It should consist of

cd C:\Windows\System32\

rasdial.exe “MY VPN” “DOMAINNAME\USERNAME” “PASSWORD

Replace “DOMAINNAME\USERNAME” “PASSWORD” with your own. Save this batch file on your %systemdrive%. When you are done you should have a AUTOVPN.bat file.

3. Setup the VPN auto connect task in Windows Task Scheduler

clip_image002

clip_image003

clip_image004

clip_image005

clip_image006

Click ok and now your task should be set and your computer will connect to VPN automatically on startup of Windows.



Article ID: 117
Created On: Mon, Oct 10, 2022 at 2:38 PM
Last Updated On: Mon, Oct 10, 2022 at 2:38 PM
Authored by: Saeed Nobakht [[email protected]]

Online URL: https://www.navel.ir/article/configure-windows-to-automatically-connect-to-vpn-by-windows-task-scheduler-117.html