User Guide - OpenVPN as a system service on Windows

Starting from the OpenVPN Connect app version 3.2, the application includes the OpenVPN Service binary that allows running a VPN connection as a system service. This means that if the service was properly installed and configured it will establish a VPN connection automatically on system start-up, regardless of whether it was explicitly started or not.

Follow these steps in order to do that on Windows:

Connect App Installation

  1. Go to https://openvpn.net/client-connect-vpn-for-windows/ and click Download OpenVPN Connect V3. Note: If you are using OpenVPN Cloud or OpenVPN Access Server, you may also download OpenVPN Connect with an already existing OpenVPN Profile (needed to connect to VPN) on the portal
  2. After the download has been completed, click on the setup in the Downloads pop-up bar in your browser
  3. In the OpenVPN Connect Setup Wizard that has just opened, click Next
  4. Read the License Agreement and click on the I accept the terms in the License Agreement checkmark (in case you accept the terms)
  5. Click Next
  6. In the Driver Selection window, choose a driver and click Next
  7. Click the Install button in order to begin the installation process
  8. Finally, click Finish in order to finish the setup process after the installation has been completed

Starting System Service

  1. Press Win+S on your keyboard in order to open the Search window, then type cmd in order to find the Command Prompt
  2. Now, click Run as administrator in the panel on the right
  3. Type cd/ in the Command Prompt Window in order to go to the top of the directory tree
  4. Next, type cd %ProgramFiles%/OpenVPN Connect (if you are using the x64 version) or cd %ProgramFiles(x86)%>/OpenVPN Connect (if you are using the x86 version) in the Command Prompt Window in order to navigate to the default directory where OpenVPN Connect is located
  5. Install the system service by typing the following command into the Command Prompt: ovpnconnector.exe install. Note: the system service will not be automatically installed when you install the OpenVPN Connect app. You will still have to install the service in the Command Prompt after you have installed the app
  6. (Optional) Now, configure the OpenVPN profile that will be running automatically with system service by typing the following command into the Command Prompt: ovpnconnector.exe set-config profile <path-to-profile.ovpn>. Important: Only autologin profiles are supported at the current moment. Important: Even if the downloaded profile has been moved to %ProgramFiles%/OpenVPN Connect, you still have to enter the full path to the OpenVPN profile, as shown in the video below. Note: If this step was skipped, the service will try to connect via profile located at the service directory named ovpnconnector.ovpn. If Connect client was downloaded form OpenVPN Access Server or OpenVPN Cloud and has a bundled profile, ovpnconnector.ovpn is a copy of a bundled profile
  7. (Optional) Specify the path to a log file by typing the following command into the Command Prompt: ovpnconnector.exe set-config log <path-to-log>. Important: The log file will only appear in the intended directory only after the connection has been established. If there is no log file in the directory, then the connection has not been established. Note: If not specified, the service will write logs to the file located at the same directory named ovpnconnector.log. Note: Apart from writing regular OpenVPN logs to the configured log file service will also report any critical errors to the system Event Viewer → Windows Logs → Applications. (Event source: OVPNConnectorService)
  8. Start the service by typing the following command into the Command Prompt: ovpnconnector.exe start. This command will try to establish a connection via a configured VPN profile using system service. Important: OpenVPN Connect client should not be running, otherwise service startup will abort.
  9. Open the log file you specified at Step 7 or the default %ProgramFiles%/OpenVPN Connect/ovpnconnector.log in order to verify that the VPN connection was successfully established. Scroll to the very end, and find the line <timestamp> EVENT: CONNECTED <OpenVPN profile name>, which will confirm the connection success. Important: The log file will only appear in the intended directory if the connection was successful. If there is no log file, then the connection has not been established
  10. Notice that you can’t use OpenVPN Connect when service is running, the application UI will be blocked by the corresponding modal window. It will disappear if you stop the service

Notice how now, if you restart your machine, the VPN connection will be established automatically on system start-up thanks to this system service, regardless of whether it was explicitly started or not.

Using System Service

  1. You can check service status in Windows Services utility by pressing Win+S and typing Services into the Windows search bar and clicking Services in the search results
  2. Here, find the OpenVPN Connect 3.x Connector service in the Windows Services tab. Notice how now, if you restart your machine, the VPN connection will be established automatically on system start-up thanks to this system service, regardless of whether it was explicitly started or not
  3. Notice that you can stop or restart the service from this tab. If you click Stop, the VPN connection will be terminated. Important: Connection will restart automatically after the system reboot unless you remove the service
  4. You will also be able to start the service in case it was stopped from the Windows Services tab

Stop and Remove System Service

  1. You can stop the service by entering the following command into the Command Prompt: ovpnconnector.exe stop. A VPN connection will be terminated. Important: Connection will restart automatically after the system reboot unless you remove the service
  2. Configured paths to VPN profile and the log file can be rolled back to default values using the following commands in the Command Prompt: ovpnconnector.exe unset-config profile and ovpnconnector.exe unset-config log. Important: The service needs to be stopped first to change the configuration. Important: You will be able to use a different OpenVPN session as a system service only after running ovpnconnector.exe unset-config profile, as a System Service will still be present, but it won’t have the Running status in Windows Services since it will have no OpenVPN Profile associated with it. Afterward, to change the OpenVPN Profile of the system service, simply go through the steps in the section Starting System Service with a new OpenVPN profile
  3. If you want to remove system service run the command: ovpnconnector.exe remove

Default OpenVPN settings for connection

  • Connection Timeout: “Continuously retry” (try to connect indefinitely)
  • Seamless Tunnel: Enabled (Block VPN while VPN is paused or reconnecting)
  • The rest of the settings can be configured in the profile itself.