27 lines
1.0 KiB
PowerShell
27 lines
1.0 KiB
PowerShell
$OpenVPNVersion = "2.4.7"
|
|
|
|
## 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
|
|
ElseIf ( IsWindowsVersion -ge "7.0" )
|
|
{ $URL = "https://swupdate.openvpn.org/community/releases/openvpn-install-${OpenVPNVersion}-I607-Win7.exe" }
|
|
|
|
## Install package
|
|
Install-Program -Path $(Download-File -URL $URL) -Arguments "/S" -Delete
|
|
|
|
## 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 )
|
|
{
|
|
Write-Output "Deleting desktop shortcut: ${Shortcut}"
|
|
Try { Remove-Item $Shortcut -Force }
|
|
Catch { Write-Error $_.Exception.Message }
|
|
}
|
|
}
|
|
Else { Write-Output "Must be an administrator to install OpenVPN" } |