download and install instead of direct installation

This commit is contained in:
2021-02-19 09:15:57 -05:00
parent 35a7cfeff7
commit 4d8fff82f1
+6 -1
View File
@@ -8,9 +8,14 @@ If ( IsAdmin )
Else { $URL = 'https://download.wireguard.com/windows-client/wireguard-x86-latest.msi' } Else { $URL = 'https://download.wireguard.com/windows-client/wireguard-x86-latest.msi' }
## Install package ## Install package
Try { Start-Process "msiexec.exe" -ArgumentList "/i ${URL} /qn /norestart DO_NOT_LAUNCH=1" -Wait -ErrorAction Stop } $Installer = Download-File -URL $URL
Try { Start-Process "msiexec.exe" -ArgumentList "/i ${Installer} /qn /norestart DO_NOT_LAUNCH=1" -Wait -ErrorAction Stop }
Catch { LogErr $_.Exception.Message ; Exit } Catch { LogErr $_.Exception.Message ; Exit }
## Delete installer
Try { If ( Test-Path $Installer ) { Remove-Item $Installer -Force } }
Catch { LogErr $_.Exception.Message }
## Install manager service ## Install manager service
Try { Start-Process "${Env:ProgramFiles}\WireGuard\wireguard.exe" -ArgumentList '/installmanagerservice' -Wait -ErrorAction SilentlyContinue } Try { Start-Process "${Env:ProgramFiles}\WireGuard\wireguard.exe" -ArgumentList '/installmanagerservice' -Wait -ErrorAction SilentlyContinue }
Catch { LogErr $_.Exception.Message } Catch { LogErr $_.Exception.Message }