diff --git a/Install-Wireguard.ps1 b/Install-Wireguard.ps1 index c08fbb2..1d101f5 100644 --- a/Install-Wireguard.ps1 +++ b/Install-Wireguard.ps1 @@ -1,20 +1,15 @@ +. 'C:\Users\dyoder\Emberkom\Data\Projects\development\management-scripts\Tools.ps1' ## Make sure we have an administrative token If ( IsAdmin ) { - $URL = "https://download.wireguard.com/windows-client/wireguard-installer.exe" + If ( Is64bit ) { $URL = 'https://download.wireguard.com/windows-client/wireguard-amd64-latest.msi' } + Else { $URL = 'https://download.wireguard.com/windows-client/wireguard-x86-latest.msi' } - ## Download package - $Installer = Download-File -URL $URL - If ( Test-Path $Installer ) { + ## Install package + Try { Start-Process "msiexec.exe" -ArgumentList "/i ${URL} /qn /norestart DO_NOT_LAUNCH=1" -Wait } + Catch { LogErr $_.Exception.Message } - ## Install package - End-Process -Name "wireguard" -Match -Force - Install-Program -Path "${Installer}" -Delete - End-Process -Name "wireguard" -Match -Force - - ## Create shortcut on Public desktop - #Create-Shortcut -Path "${Env:Public}\Desktop\WireGuard.LNK" -TargetPath "${Env:ProgramFiles}\WireGuard\wireguard.exe" -Description "WireGuard: Fast, Modern, Secure VPN Tunnel" - } - Else { LogMsg "The WireGuard installer was not downloaded properly" } + ## Create shortcut on Public desktop + #Create-Shortcut -Path "${Env:Public}\Desktop\WireGuard.LNK" -TargetPath "${Env:ProgramFiles}\WireGuard\wireguard.exe" -Description "WireGuard: Fast, Modern, Secure VPN Tunnel" } Else { LogMsg "Must be an administrator to install WireGuard" } \ No newline at end of file