Skip to content

Conversation

NiKiZe
Copy link

@NiKiZe NiKiZe commented Apr 15, 2021

This can be used to provide an alternative reg path to where to look for configuration, instead of the default hardcoded HKLM\Software\OpenVPN

Use by changing the settings on the ImagePath on the service.
Example:

$binDir = [System.IO.Path]::Combine($PSScriptRoot, "bin")
$svcPath = [System.IO.Path]::Combine($binDir, "openvpnserv2.exe")
$params = @{
  Name = "MyVPNService"
  BinaryPathName = "$svcPath -BaseRegName MyRegKeyName"
  DependsOn = ("Dhcp", "tap0901")
  DisplayName = "MyVPNService OpenVPN"
  StartupType = "Automatic "
  Description = "MyVPNService"
}
New-Service @params | Start-Service

NiKiZe added 2 commits April 15, 2021 14:49
Arguments can be used for configuration, so allow for them to exist
Handling UserInteractive allows debugging without installing as service

Signed-off-by: Christian Nilsson <[email protected]>
which is used to override OpenVPN part of HKLM\Software\OpenVPN reg path
Used to configure service to use HKLM\Software\MyNameVPN as configuration root.
Allowing for multiple freestanding instances of openvpn service to coexist on the same system

Also simpler handling on registry key enumeration via Linq

Signed-off-by: Christian Nilsson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant