This is a guide explaining how you can set your OpenVPN client to run automatically when you start your computer. The guide is specific to Windows.
1. Task Scheduler
Click the Start button and go to Programs » Accessories » System. Then run Task Scheduler.
If you don’t have the Start button, just search for Task Scheduler.
Click Create basic task on the Actions menu on the right-hand side.
{<1>}
2. Create a basic task
Enter OpenVPN as the name for the new activity and click Next.
{<2>}
3. Set the trigger
It’s now time to set the trigger. Choose When I log on, and click Next.
{<3>}
4. Choose action
Under Action, choose Start a program, and click Next.
{<4>}
5. Choose an application to run
It’s time to choose the program that should be opened when you log in. Click Browse, and look up openvpn-gui.exe. Usually you can find the program in:
C:\Program Files\OpenVPN\bin
or
C:\Program Files (x86)\OpenVPN\bin
In the field Add arguments (optional ), type:
--connect "OVPN - Sverige.ovpn"
IF the configuration file you are using is named OVPN - Sverige.ovpn. If the name of your file is different, enter that name instead
{<5>}
6. Finishing up
Check the box Open the Properties dialog for this task when I click Finish.
Then click Finish.
{<6>}
7. Set user privileges
A new window should now open called Properties for OpenVPN (Local Computer). On the opened tab, check **Run with highest privileges **, and click OK.
{<7>}
Further configurations
If you’ve followed the steps in the guide, OpenVPN will now be run when you log in.
To automatically connect to OVPN, you need to make a few more configurations. This requires you to enter your username and password in a text file and save it on your computer.
If you are not comfortable with having a text file with your credentials saved, there is, unfortunately, no other way to automatically connect to OVPN on computer startup.
1 – Create a text file
Go to the configuration directory where you keep the configuration files for OVPN. Usually, they can be found in:
C:\Program Files\OpenVPN\config
or
C:\Program Files (x86)\OpenVPN\config
Create a file called password.txt. On the first line, write your username and on the second line your password.
Edit the configuration file that you are using to connect to OVPN by opening the file with a text editor such as Notepad++.
Find the command auth-user-pass and change it to auth-user-pass password.txt.
Then save the configuration file.
3. Done
You’re done! You can test it by logging out and in again. If you automatically connect to OVPN when you log in, it’s working!