---
title: Running OpenVPN as a Windows Service
canonical: https://openvpn.net/community-docs/running-openvpn-as-a-windows-service/
product: Community Docs
---

# Running OpenVPN as a Windows Service

When OpenVPN runs as a service, it will start a separate OpenVPN process for each configuration file it finds in the **\\Program Files\\OpenVPN\\config-auto** directory and will output a logfile of the same name to the **\\Program Files\\OpenVPN\\log** directory.

When installed as a service, OpenVPN will default to Automatic Start mode. You can go to the "Services" control panel in **Control Panel \> Administrative Tools** to stop and start the service or change its system startup behavior.

Sample config files for client or server functionality have been provided in \\Program Files\\OpenVPN\\sample-config, which can be adapted to your needs.

## Service notes

When you install OpenVPN as a service, you are installing **openvpnserv2.exe**, a service wrapper for OpenVPN, i.e., it reads the config file directory and starts a separate OpenVPN process for each config file. **openvpnserv2.exe** performs the same function under Windows as the **/etc/init.d/openvpn** startup script does under Linux.

When you stop the OpenVPN service, it will send a terminate signal to all OpenVPN processes it started.

If the OpenVPN service wrapper (**openvpnserv2.exe**) encounters fatal errors, it will write them to the Windows event log, which can be viewed in **Control Panel \> Administrative Tools \> Event Viewer \> Application Log**.

If the OpenVPN processes encounter errors, they will write them to their respective log files in the log file directory.

There is a one-to-one correspondence between an OpenVPN process, an OpenVPN config file, an OpenVPN log file, and a TAP-Win32 adapter representing a VPN tunnel endpoint.

OpenVPN tunnels are point-to-point in their simplest form but can be made point-to-multi-point through bridging or routing (see below).

Multiple OpenVPN processes can run concurrently, each on a different TAP-Windows adapter.

**openvpn.exe** gets all configuration information from its config file, not the registry.

The **openvpnserv2.exe** program (the service wrapper) gets several string parameters from the registry, which can be modified by the user. If you change any of these parameters, you can upgrade OpenVPN to a new version without the installer overwriting your changes: **HKEY\_LOCAL\_MACHINE\\SOFTWARE\\OpenVPN**.

- **autostart\_config\_dir:** The configuration file directory to scan, defaults to **\\Program Files\\OpenVPN\\config-auto**.
- **config\_ext:** The file extension on configuration files, defaults to "ovpn".
- **exe\_path:** The path to **openvpn.exe**, defaults to **\\Program Files\\OpenVPN\\bin\\openvpn.exe**.
- **log\_dir:** The log file directory, defaults to **\\Program Files\\OpenVPN\\log**.
- **log\_append:** If set to **1**, multiple instantiations of an OpenVPN process will append onto the same log file. If set to **0** (default), each new instantiation will truncate the previous log file priority. The Windows priority class for each instantiated OpenVPN process can be one of:
  - IDLE\_PRIORITY\_CLASS
  - BELOW\_NORMAL\_PRIORITY\_CLASS
  - NORMAL\_PRIORITY\_CLASS (default)
  - ABOVE\_NORMAL\_PRIORITY\_CLASS
  - HIGH\_PRIORITY\_CLASS

---

Prev: [Running OpenVPN from a console window](https://openvpn.net/community-docs/running-openvpn-from-a-console-window.md)
Next: [Static Key Mini-HOWTO](https://openvpn.net/community-docs/static-key-mini-howto.md)
Index: https://openvpn.net/community-docs/llms.txt
