From 76148f6b871c2d9f90c6b2a902069170cacaf2f8 Mon Sep 17 00:00:00 2001 From: dyoder Date: Tue, 24 Nov 2020 08:37:53 -0500 Subject: [PATCH] remove unnecessary windows version check added a few lines to delete the desktop shortcut after installing --- Install-OpenVPN.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Install-OpenVPN.ps1 b/Install-OpenVPN.ps1 index a00ced8..be9c814 100644 --- a/Install-OpenVPN.ps1 +++ b/Install-OpenVPN.ps1 @@ -8,10 +8,20 @@ If ( IsAdmin ) { $URL = "https://swupdate.openvpn.org/community/releases/openvpn-install-${OpenVPNVersion}-I607-Win10.exe" } ## URL for Windows 7 - ElseIf ( (IsWindowsVersion -ge "7.0") -and (IsWindowsVersion -lt "10.0") ) + 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 ) + { + LogMsg "Deleting desktop shortcut: ${Shortcut}" + Try { Remove-Item $Shortcut -Force } + Catch { LogErr $_.Exception.Message } + } } Else { LogMsg "Must be an administrator to install OpenVPN" } \ No newline at end of file