how to list, by command line, firewall rules filter by...

Ale Madama 291 Reputation points
2021-03-22T10:46:47.597+00:00

Hi all,
I would like to use "netsh advfirewall firewall" commands, to list only some rule

for example, filter by:

only blocked rules
only rules belonging to a certain group name

more, if possible, list only rule having name starting with "blabla", then I guess using wildcards...

thanks!

Windows for business | Windows Client for IT Pros | Devices and deployment | Configure application groups
0 comments No comments
{count} votes

Answer accepted by question author
  1. Castorix31 91,506 Reputation points
    2021-03-22T11:41:29.4+00:00

    You can use findstr to filter names but it is simpler with PowerShell

    For example, a test with some filters :

    Show-NetFirewallRule | where {$_.DisplayName -Like "*Test*" -AND $_.Action -eq 'Block' -AND $_.Direction -eq "Inbound"} | select DisplayName
    
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Ale Madama 291 Reputation points
    2021-03-22T12:58:19.07+00:00

    excellent castorix, thank you!

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.