A PowerShell tool for automatically creating and connecting temporary OpenVPN profiles. Credentials are stored in the Windows Registry and securely deleted after use.
SetAndRun.ps1: Sets up credentials and starts VPN
$profile = "<profile name>"
$username = "<auth username>"
$authpwd = "<auth password>"
$privpwd = "<private key password>"GetStatus.ps1: Returns connection state of selected VPN profile, works only for TCP VPN profiles
$profile = "<profile name>"GetCreds.ps1: Returns vpn credentials of all VPN profiles
To start PS script in background you can use:
powershell -windowstyle hidden -file C:\some\path\to\SetAndStart.ps1
Copy downloaded OVPN profile:
$downloadpath = "C:\Users\$currentuser\Downloads\$profile.ovpn"
...
Copy-Item $downloadpath -Destination "C:\Users\$currentuser\OpenVPN\config"Start-Process -FilePath "C:\Program Files\OpenVPN\bin\openvpn-gui.exe" -ArgumentList "--connect $profile.ovpn"π‘ This delay is important: without enabling silent connection mode in OpenVPN GUI, the connection dialog pauses for 5 seconds waiting for user confirmation β plus additional time for the actual connection to establish.
Start-Sleep -Seconds 8Remove-Item -Path "$regPath\" -RecurseRight click on tray icon and click on settings, in General tab check the Silent connection
