From a95b148ddc4cdc814c2e94445cf45e959476b113 Mon Sep 17 00:00:00 2001 From: David Yoder Date: Sat, 23 Oct 2021 08:56:12 -0400 Subject: [PATCH] added script to update wireguard if it's installed --- Update-Wireguard.ps1 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Update-Wireguard.ps1 diff --git a/Update-Wireguard.ps1 b/Update-Wireguard.ps1 new file mode 100644 index 0000000..0575409 --- /dev/null +++ b/Update-Wireguard.ps1 @@ -0,0 +1,21 @@ +If (IsAdmin) { + + ## Get the path to wireguard.exe + If (Test-Path "${Env:ProgramFiles}\Wireguard\wireguard.exe") { + $PATH = "${Env:ProgramFiles}\Wireguard\wireguard.exe" + } + ElseIf (Test-Path "${Env:ProgramFiles}\Wireguard\wireguard.exe") { + $PATH = "${Env:ProgramFiles}\Wireguard\wireguard.exe" + } + Else { $PATH = "" } + + ## If the path to wireguard.exe is found, update the app + If ( -not [string]::IsNullOrEmpty($PATH) ) { + LogMsg "Updating Wireguard" + Try { Start-Process $PATH -ArgumentList "/update" -Wait } + Catch { LogErr $_.Exception.Message } + LogMsg "Finished updating Wireguard" + } +} + +Else { LogMsg "You must be a local administrator to update Wireguard" } \ No newline at end of file