Use netsh to show enabled firewall rules only

Posted on

A server stack is the collection of software that forms the operational infrastructure on a given machine. In a computing context, a stack is an ordered pile. A server stack is one type of solution stack — an ordered selection of software that makes it possible to complete a particular task. Like in this post about Use netsh to show enabled firewall rules only was one problem in server stack that need for a solution. Below are some tips in manage your windows server when you find problem about windows, firewall, netsh, , .

I’m using the following command to list firewall rules

netsh advfirewall firewall show rule dir=in name=all

How can I display enabled rules only? There’s no switch like enabled=true

netsh advfirewall is not recommended anymore and might be deprecated in future versions of Windows (see the warning message when you enter netsh advfirewall).

Additionally, I’m not aware of an “enabled” switch in netsh advfirewall firewall

I suggest you use Powershell to get the list of enabled inbound rules :

Get-NetFirewallRule -Direction Inbound -Enabled True

I think this Powershell command might be useful in your case:

netsh advfirewall firewall show rule dir=in name=all | Select-String -Pattern 'Yes' -Exclude "Edge traversal" -AllMatches -Context 2,11

Leave a Reply

Your email address will not be published.