Files

27 lines
1.0 KiB
PowerShell
Raw Permalink Normal View History

2020-10-22 14:01:35 -04:00
$OpenVPNVersion = "2.4.7"
2020-09-04 09:14:24 -04:00
2020-10-22 14:01:35 -04:00
## Make sure we have an administrative token
If ( IsAdmin )
{
## URL for Windows 10
If ( IsWindowsVersion -ge "10.0" )
{ $URL = "https://swupdate.openvpn.org/community/releases/openvpn-install-${OpenVPNVersion}-I607-Win10.exe" }
## URL for Windows 7
2020-11-24 08:37:53 -05:00
ElseIf ( IsWindowsVersion -ge "7.0" )
2020-10-22 14:01:35 -04:00
{ $URL = "https://swupdate.openvpn.org/community/releases/openvpn-install-${OpenVPNVersion}-I607-Win7.exe" }
2020-09-04 09:14:24 -04:00
2020-10-22 14:01:35 -04:00
## Install package
2020-11-19 17:50:42 -05:00
Install-Program -Path $(Download-File -URL $URL) -Arguments "/S" -Delete
2020-11-24 08:37:53 -05:00
## Delete the shortcut on the Public Desktop
If ( Test-Path $Env:PUBLIC ) { $Shortcut = "${Env:PUBLIC}\Desktop\OpenVPN GUI.LNK" }
Else { $Shortcut = "${Env:SYSTEMDRIVE}\Users\Public\Desktop\OpenVPN GUI.LNK" }
If ( Test-Path $Shortcut )
{
2023-10-05 13:11:38 -04:00
Write-Output "Deleting desktop shortcut: ${Shortcut}"
2020-11-24 08:37:53 -05:00
Try { Remove-Item $Shortcut -Force }
2023-10-05 13:17:18 -04:00
Catch { Write-Error $_.Exception.Message }
2020-11-24 08:37:53 -05:00
}
2020-09-04 09:14:24 -04:00
}
2023-10-05 13:11:38 -04:00
Else { Write-Output "Must be an administrator to install OpenVPN" }