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:<TAB>Public,Private".
Yet your script expects the key name printed out to be "Profile:<TAB>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.
This commit is contained in:
Dreamcat4 2015-10-05 21:36:24 +01:00 committed by Matt Clay
parent b9dd3568f3
commit f64e438150

View file

@ -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));