diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-10-07 13:48:28 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-10-07 13:48:28 +0200 |
| commit | ade41b05cce4a555197116568664220c5b3be9fa (patch) | |
| tree | ee0124111e4e500d648a133db7feedfec13b4f2b /packaging/win | |
| parent | 3d5a168ee592c28c696e445c623c9f8d2996b715 (diff) | |
| download | meshbay-ade41b05cce4a555197116568664220c5b3be9fa.tar.gz | |
fix(client): remove firewall rules and boot task on uninstall, unasked
The Yes/No before it defaulted to No, so they stayed behind. Read both
unelevated and raise the UAC prompt only when one is left.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packaging/win')
| -rw-r--r-- | packaging/win/firewall.ps1 | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/packaging/win/firewall.ps1 b/packaging/win/firewall.ps1 index 9b3687a..939a58e 100644 --- a/packaging/win/firewall.ps1 +++ b/packaging/win/firewall.ps1 @@ -39,10 +39,13 @@ add (default) create/replace the rules remove delete them check exit 0 if all rules already exist, 1 otherwise -- no admin needed + any exit 0 if at least one rule exists, 1 otherwise -- no admin + needed; the uninstallers elevate only when this says there is + something to remove #> [CmdletBinding()] param( - [ValidateSet("add", "remove", "check")] + [ValidateSet("add", "remove", "check", "any")] [string]$Action = "add" ) @@ -76,6 +79,12 @@ if ($Action -eq "check") { exit 0 } +if ($Action -eq "any") { + $present = $rules | Where-Object { Get-NetFirewallRule -DisplayName $_.Name -ErrorAction SilentlyContinue } + if ($present) { exit 0 } + exit 1 +} + $ErrorActionPreference = "Stop" try { foreach ($r in $rules) { |