added script to update wireguard if it's installed

This commit is contained in:
2021-10-23 08:56:12 -04:00
parent 6b690b23f3
commit a95b148ddc
+21
View File
@@ -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" }