On Windows 11, the Microsoft Defender Firewall is a security feature that monitors incoming and outgoing network traffic to allow or block traffic depending on configured rules.
Although the default settings should be optimal for most users, you can create new custom rules to control the network access for apps and services. However, the Microsoft Defender Firewall settings, Command Prompt, or PowerShell do not provide an option to export a specific firewall rule.
In the case that you have to transfer a specific firewall rule to other devices 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 and import specific firewall rules on the same or other devices.
Export single firewall rule on Windows 11
On Windows 11, the only way to export a single firewall rule is to export all the rules and then modify the list to include only the rules you want to import using the Registry and Notepad.
Export firewall rules from Registry
To export firewall rules from the Registry, use these steps:
-
Open Start on Windows 11.
-
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.
-
Click the Save button.
Once you complete the steps, the exported file will contain all the firewall rules. The next step is 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 into another system.
Create firewall export with one rule
To export a single firewall rule on Windows 11, use these steps:
-
Open File Explorer.
-
Open the folder with the FirewallRules key export.
-
Shift + Right-click the file and select the Edit option from the lecagy context menu.
-
Select the first three lines of the file.
-
Right-click the selection and select the Copy option.
-
Click the New tab button to create a new Notepad file.
-
Right-click and choose the Paste option.
-
Switch back to the file containing the FirewallRules key export.
-
Carefully select the line containing the firewall rules to export, right-click the selection, and click the Copy option.
-
Switch back to the new Notepad files containing the three new lines.
-
Position the typing cursor below the third line.
-
Right-click and choose the Paste option.
-
Repeat steps 10 through 13 to export multiple firewall rules on Windows 11.
-
Click the File menu.
-
Click the Save as option.
-
Select a descriptive file name for the export.
-
Click the Save button.
After you complete the steps, you will have a file containing only the firewall rules you need.
Import single firewall rule on Windows 11
To import a single firewall rule, use these steps:
-
Open File Explorer.
-
Open the location containing the modified “.reg” file containing the firewall to import.
-
Double-click the “.reg” file.
-
Click the Yes button.
-
Click the OK button.
Once you complete the steps, you can open the Microsoft Defender Firewall on Windows 11 with the Advanced Security console to confirm the rule has been added.