Why doesn’t Get-NetFirewallRule show all information of the firewall rule?

Question:

I’m trying to find if a firewall rule already existing, with the same name, same configuration, like: localport.

So I use Get-NetFirewallRule to list all rules, but the rules returned do not contain the information of port, also some other information are missing. where can I find all the config of a rule. Below is the attributess returned:

Answer:

What I don’t think is understood by many, including me recently, is that the Get-NetFirewall*Filter commands provide a speedy shortcut to searching the firewall rules, like the -filter option does in other commands. If I were to do this, it would take a very long time:

While this is almost instant:

And Get-NetFirewallPortFilter actually returns the name of the firewall rule in the InstanceID property, which isn’t shown by default. That’s why you can pipe Get-NetFirewallPortFilter back into Get-NetFirewallRule.

Here’s a function that gives netsh-like verbose output, with the ports, addresses, and applications:

Source:

Why doesn’t Get-NetFirewallRule show all information of the firewall rule? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply