How to export and import specific firewall rule on Windows 10

Yes, it's possible to export and import only one firewall rule on Windows 10, but you need to use the Registry with this workaround.

Windows 10 export and import single firewall rule
Windows 10 export and import single firewall rule

On Windows 10, the Microsoft Defender Firewall feature monitors incoming and outgoing network traffic to allow or block traffic depending on predefined rules.

Although every system has the same default rules, you can always create new custom rules to prevent apps from accessing the network. However, using the Microsoft Defender Firewall console, Command Prompt, or PowerShell, you can only export and import all the rules, not a specific firewall rule.

If you have to import a single rule on multiple computers without overwriting the current configuration, you can create a custom export file using the Registry and Notepad.

This guide will teach you the steps to export a specific rule that you can import on the same or other devices.

Export single firewall rule on Windows 10

To export a single firewall rule, you have to export all the rules and then modify the list to include only the rules you want to import using the Registry and Notepad. Here’s how.

Warning: It’s important to note that modifying the Windows Registry can cause serious problems if not used properly. It’s assumed you know what you’re doing and have created a full backup of your system before proceeding.

Export firewall rules from Registry

To export firewall rules with the Registry on Windows 10, use these steps:

  1. Open Start on Windows 10.

  2. Search for regedit and click the top result to open the Registry.

  3. Browse the following path:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy
  4. Right-click the FirewallRules key and select the Export option.

    Registry export FirewallRules

  5. Type the name for the .reg file. For example, firewall-export-date.reg.

    Registry save reg file on Windows 10

  6. Click the Save button.

Once you complete the steps, you’ll need to open the exported file with Notepad to remove the entries you don’t need or create a new “.reg” file containing only the entries you want to import.

Create firewall export with one rule

To export a single firewall rule on Windows 10, use these steps:

  1. Open File Explorer.

  2. Browse to the folder where you exported the FirewallRules key.

  3. Right-click the file the Edit option.

    Registry file open with Notepad

  4. Select the first three lines.

  5. Right-click the selection and click the Copy option.

    Registry firewallrules copy entries

  6. Open Start.

  7. Search for Notepad and click the top result to open the app.

  8. Right-click and select the Paste option.

    Single firewall rule configuration

  9. Go back to the file containing the FirewallRules key.

  10. Carefully select the line containing the firewall rules to export and click the Copy option.

    Registry file exporting single firewall rule

  11. Go back to the new Notepad files containing the three lines you pasted earlier.

  12. Position the typing cursor below the third line.

  13. Right-click and select the Paste option.

    Paste firewall rule custom configuration file

  14. Repeat steps 10 through 13 to export multiple firewall rules on Windows 10.

  15. Click the File menu.

  16. Click the Save as option.

  17. Select a descriptive file name for the export—for example, firewall-app-name-rule.reg.

  18. Click the Save button.

After completing the steps, you’ll end up with an export file containing only the firewall rules you want to export.

Import single firewall rule on Windows 10

To import a single firewall rule on Windows 10, use these steps:

  1. Open File Explorer.

  2. Browse to the modified .reg file containing the firewall to import.

  3. Double-click the .reg file.

  4. Click the Yes button to confirm.

    Import single firewall rule on Windows 10

  5. Click the OK button.

Once you complete the steps, you can open the Microsoft Defender Firewall with the Advanced Security console to confirm the rule has been added.

This guide works on Windows 10, but these instructions should apply to Windows 8.1 and 7.

About the author

Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 15 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 21 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and About.me. Email him at [email protected].