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.
Export firewall rules from Registry
To export firewall rules with the Registry on Windows 10, use these steps:
-
Open Start on Windows 10.
-
Search for regedit and click the top result to open the Registry.
-
Browse the following path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy
-
Right-click the FirewallRules key and select the Export option.
-
Type the name for the .reg file. For example, firewall-export-date.reg.
-
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:
-
Open File Explorer.
-
Browse to the folder where you exported the FirewallRules key.
-
Right-click the file the Edit option.
-
Select the first three lines.
-
Right-click the selection and click the Copy option.
-
Open Start.
-
Search for Notepad and click the top result to open the app.
-
Right-click and select the Paste option.
-
Go back to the file containing the FirewallRules key.
-
Carefully select the line containing the firewall rules to export and click the Copy option.
-
Go back to the new Notepad files containing the three lines you pasted earlier.
-
Position the typing cursor below the third line.
-
Right-click and select the Paste option.
-
Repeat steps 10 through 13 to export multiple firewall rules on Windows 10.
-
Click the File menu.
-
Click the Save as option.
-
Select a descriptive file name for the export—for example, firewall-app-name-rule.reg.
-
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:
-
Open File Explorer.
-
Browse to the modified .reg file containing the firewall to import.
-
Double-click the .reg file.
-
Click the Yes button to confirm.
-
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.