File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ function Invoke-IcingaCheckFirewall()
5151 $FirewallPackage = New-IcingaCheckPackage - Name ' Firewall profiles' - OperatorAnd - Verbos $Verbosity ;
5252
5353 foreach ($singleprofile in $Profile ) {
54- $FirewallData = (Get-NetFirewallProfile - Name $singleprofile )
55- $FirewallCheck = New-IcingaCheck - Name " Firewall Profile $singleprofile " - Value $FirewallData.Enabled - Translation @ { ' true' = ' Enabled' ; ' false' = ' Disabled' };
54+ $FirewallData = (Get-NetFirewallProfile - Name $singleprofile - ErrorAction SilentlyContinue);
55+ $FirewallCheck = New-IcingaCheck - Name " Firewall Profile $singleprofile " - Value $FirewallData.Enabled - ObjectExists $FirewallData - Translation @ { ' true' = ' Enabled' ; ' false' = ' Disabled' };
5656 $FirewallCheck.CritIfNotMatch ([string ]$Enabled ) | Out-Null ;
5757 $FirewallPackage.AddCheck ($FirewallCheck )
5858 }
You can’t perform that action at this time.
0 commit comments