Merge pull request #5704 from inspec/vasundhara/fix-winodws-firewall-resource

Fix windows_firewall resource fails to validate more than 1 rule depending on how it's executed
This commit is contained in:
Clinton Wolfe 2021-10-25 18:34:30 -04:00 committed by GitHub
commit 45d638e224
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -77,7 +77,7 @@ module Inspec::Resources
def load_firewall_profile(profile_name)
<<-EOH
Remove-TypeData System.Array # workaround for PS bug here: https://bit.ly/2SRMQ8M
Get-TypeData -TypeName System.Array | Remove-TypeData # workaround for PS bug here: https://bit.ly/2SRMQ8M
$profile = Get-NetFirewallProfile -Name "#{profile_name}"
$count = @($profile | Get-NetFirewallRule).Count
([PSCustomObject]@{