Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Get all Windows Firewall rules that specify a program and show those which are inbound and enabled
- ## Cache rules and ports for cross referencing
- $allrules = Get-NetFirewallRule
- $allports = Get-NetFirewallPortFilter
- # pipe through sort -property your_choice_of_property
- Get-NetFirewallApplicationFilter |select @{n='Program';e={$_.Program}},@{n='Rule';e={$allrules|Where Name -ieq $_.InstanceID}}|where { $_.rule.Enabled -eq 'true' -and $_.rule.Direction -ieq 'inbound'} |select Program,@{n='Rule';e={$_.rule.displayname}},@{n='Ports';e={$script:port = $allports|where InstanceID -eq $_.rule.Name;$script:port.Localport}},@{n='Protocol';e={$script:port.protocol}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement