2021-10-23 08:56:12 -04:00
|
|
|
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) ) {
|
2023-10-05 13:11:38 -04:00
|
|
|
Write-Output "Updating Wireguard"
|
2021-10-23 08:56:12 -04:00
|
|
|
Try { Start-Process $PATH -ArgumentList "/update" -Wait }
|
2023-10-05 13:17:18 -04:00
|
|
|
Catch { Write-Error $_.Exception.Message }
|
2023-10-05 13:11:38 -04:00
|
|
|
Write-Output "Finished updating Wireguard"
|
2021-10-23 08:56:12 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-05 13:11:38 -04:00
|
|
|
Else { Write-Output "You must be a local administrator to update Wireguard" }
|