Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change startup to allow arguments and handle new -BaseRegName option #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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

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 <nikize@gmail.com>
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 <nikize@gmail.com>
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.

None yet

1 participant