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