From 6c5a4a14ef415e4635f7e0dc7fcb345f0c617a98 Mon Sep 17 00:00:00 2001 From: Dreamcat4 Date: Mon, 5 Oct 2015 21:36:24 +0100 Subject: [PATCH] fix: win10 - Add exception handling for 'Profiles:' textual output key name mismatch. In win10 (and pribably win8x also): The output of 'show rule' key includes the line "Profiles:Public,Private". Yet your script expects the key name printed out to be "Profile:value". This commit added the necessary exception handling to avoid flagging 'different=true' under the false circumstance. The key name to SET a firewall rule is still "profile=" and not "profiles=". There is coming up another commit to fix the value handling for win10/win8. Which is another (different) error with the profile: key. --- windows/win_firewall_rule.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/windows/win_firewall_rule.ps1 b/windows/win_firewall_rule.ps1 index 9c73507509b..0b0a2cd54f9 100644 --- a/windows/win_firewall_rule.ps1 +++ b/windows/win_firewall_rule.ps1 @@ -75,6 +75,8 @@ function getFirewallRule ($fwsettings) { $donothing=$false } elseif ((($fwsetting.Key -eq 'Name') -or ($fwsetting.Key -eq 'DisplayName')) -and ($output."Rule Name" -eq $fwsettings.$($fwsetting.Key))) { $donothing=$false + } elseif (($fwsetting.Key -eq 'Profile') -and ($output."Profiles" -eq $fwsettings.$($fwsetting.Key))) { + $donothing=$false } else { $diff=$true; $difference+=@($fwsettings.$($fwsetting.Key));