How do I Export and Import specific Window Firewall rule (both Inbound and Outbound) ?

I can do Import / Export policy but it will use ALL rules not specific rule. Same with Export List, it can export all list of rules of Inbound or Outbound in plain CSV file but it is not helpful because no way to import it back.

I looked at netsh firewall and netsh advfirewall firewall too but they too don't seem to have option to export / import individual rule.

I am just wondering if it is even possible to archive this. I am using Windows 7 Professional

6 Answers 6


Go to the following key from Windows Registry and export it to a *.reg file:


Edit the file in any text editor and remove the entries you don't want. Or you can go to WFwAS, delete any other rules and keep only the ones you want. Then do the step described above. You won't need to edit the reg file as it already contains only what you want.

Import the reg file on the computer you need and you will add only your selected rules. That's all.

Or you can try Windows Firewall Control which has a feature that does this thing. It can export and import only the selected rules in XML format:


  • WFC, best software ever for windows, it worth noting to pay for the upgraded version, then you can block outbound Windows processes and software also.
    – Moab
    Nov 15, 2019 at 13:15

Another way is to export the rules AS Tab or CSV - also within the "Windows Firewall with Advanced". Choose the "Export List.." option. You can choose TAB or CSV. You do get the whole list, but can delete all the others and either use Notepad++ and replace the delimiter with \r\n option, which will yield the list Or run a pivot in excel to give you the list.

A bit late, but hope it helps others.


You can select only the rules you want to export, then click the "export list" button and when the explorer window opens up you can tick the option to "export only highlighted rules" (just underneath the file name input field)

  • 2
    That's export LIST, not export RULE. May 10, 2019 at 18:07

Alexandru's answer was hard to follow, but led me to the right path on a Windows server 2012:

Basically, you can manually make rule changes to the FirewallRules registry key, then either Import (to replace) or Merge (to append).

Export the


as a .reg file.

Edit the file. Remove all rules that you do not want, only keep rules that you do want (e.g. copying rules from a different server to this one). Once done, you simply save the file then right click and choose Merge. This will add the new rule(s) in.

Alternatively, import the new .reg file instead, which should overwrite

  • Rather than repeat his answer, you could just edit his answer to provide details / clarity so we don't have duplicate answers Jan 14, 2020 at 12:52

Export/Import specific Firewall rules through Powershell

Source: https://gallery.technet.microsoft.com/scriptcenter/Powershell-to-export-and-23287694/view/Reviews

Find the ExportImportFirewallRules.zip over there (including script to remove Firewall rules).

As with registry actions, first take a backup (on both source and target machine!). You can backup/export the complete Firewall set as follows: right-click the top most item in the TOC of the Firewall (= Windows Defender Firewall with Advanced Security on Local Computer) choose Export Policy… save the .wfw file (e.g. AllFirewallRulesMachineName.wfw)

If necessary, activate the execution policy in Powershell (run as Administrator):

set-executionpolicy unrestricted

Export the desired rule(s). The export script can take three parameters:

  • -Name: display name of the rule(s) to be processed - wildcard * can be used - default is *
  • -CSVFile: output file - default is FirewallRules.csv
  • -JSON: use JSON instead of CSV (default is $FALSE)


.\Export-FirewallRules.ps1 '*Remote*' RemoteRules.json -json

Be aware that the same name can occur multiple times! E.g.: outbound 'Spotify Music' rule for the UDP protocol, and outbound 'Spotify Music' rule for the TCP protocol. You can of course rename the rules beforehand to make them unique, if necessary.

The import script takes two parameters:

  • -CSVFile: input file - default is FirewallRules.csv
  • -JSON: use JSON instead of CSV (default is $FALSE)

Import the rule(s) as follows: Example

.\Import-FirewallRules.ps1 RemoteRules.json -json

Once you have copied the rule, you can copy the scope data too. Just copy the data from the key and paste into the new rule on the new server. I had a deny IP rule with about a thousand IPs in the scope data that I was able to copy over to the new server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .