I'm looking for a way to export existing Windows Firewall rules using PowerShell that includes the path of the Program being referenced (for those rules which reference a program path instead of a port range).

Get-NetFirewallRule includes a lot of information but seems to be missing Program. Preferably in a human-readable format I can also automate with. Output as PowerShell objects would be best, but something tabular would be good enough.

What I've tried:

  • Get-NetFirewallRule, piping to Get-Member, piping to Format-List *
  • taking a Get-NetFirewallRule and serializing it with Export-CliXml with a high depth - the program path is not in the XML file.
  • brief (brief!) poking around netsh
  • I can manually do an export from WF.msc to get a tab delimited list, but I'd like something I can automate.
  • I did find this, but it's not human readable and looks like an all/nothing import-export, not something I could use to extract only new rules

This is in the context of managing dozens of build VMs used for continuous integration at a software company, but could also apply to system administration of our other workstations.

So far, I have not found a solution that will let me take rules on one system (specific rules) and create a PowerShell script (or GPO or whatever) to add the same rule to other machines. All I'm missing is program path. Once I have that I can easily handle the rule creation aspect.


So Get-NetFirewallRule actually returns special objects. Some of the object's properties can only be accessed with associated Get-NetFirewall* commands.

For application information, pipe the object into Get-NetFirewallApplicationFilter


PS C:\Users\Neil> get-netfirewallrule '{1A26910B-1B3B-4091-81E2-E3C7CBF02F45}' | get-netfirewallapplicationfilter

Program : C:\Program Files\MyProgram\thisProgram.exe
Package :
| improve this answer | |
  • 1
    That is it! Thank you!! internet high five, and for other things it's Get-NetFirewallPortFilter, etc etc. Now I get it. – Joshua McKinnon Oct 28 '15 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.