
If you’ve set up custom firewall rules, for example to block an app from the internet, you don’t want to lose them after a reset or recreate them on a second PC. Windows lets you export all firewall settings to one file and import them later. This works on Windows 11 and Windows 10.
Export firewall rules with Command Prompt
- Open the Start menu, type cmd, right-click Command Prompt and choose Run as administrator.
- Run this command, changing the path if you like:
netsh advfirewall export "C:\Backup\firewall-rules.wfw" - You should see Ok. The folder must already exist, so create C:\Backup first if needed.
The .wfw file contains your whole firewall policy: all inbound and outbound rules plus profile settings. Copy it to a USB drive or cloud storage to keep it safe.
Import firewall rules with Command Prompt
Important: importing replaces the current firewall policy on the PC. Any rules on this PC that are not in the file will be removed. Export the current rules first as a backup.
- Open Command Prompt as administrator.
- Run:
netsh advfirewall import "C:\Backup\firewall-rules.wfw" - Wait for Ok. The rules take effect straight away.
Do it with the firewall console instead
- Press Windows + R, type
wf.mscand press Enter. This opens Windows Defender Firewall with Advanced Security. - Click the top item in the left panel, Windows Defender Firewall with Advanced Security on Local Computer.
- In the Action menu, choose Export Policy to save a .wfw file, or Import Policy to load one.
Reset the firewall if something goes wrong
If an import breaks network access, you can return to the default rules:
netsh advfirewall reset
This deletes all custom rules, so only use it when needed. You can also use Restore defaults in the classic Windows Defender Firewall window in Control Panel.
Useful tips
- Rules created for apps that are not installed on the new PC will still import, but they do nothing until the app exists at the same path.
- Give backup files a date in the name so you know which one is newest.
Frequently asked questions
Can I export only one rule?
Not with netsh export, which saves the whole policy. For single rules, PowerShell commands such as Get-NetFirewallRule can list rule details so you can recreate them.
Does this include third-party firewall settings?
No. It only covers Windows Defender Firewall. Other security apps have their own backup options.



