This tutorial will show you how to backup (export) and restore (import) Microsoft Defender Firewall settings and rules in Windows 10 and Windows 11.
Microsoft Defender Firewall in Windows helps safeguard your device by filtering network traffic and blocking unauthorized access. It reduces the risk of network security threats by restricting or allowing traffic based on various properties such as IP addresses, ports, or program paths.
You can backup (export) your Microsoft Defender Firewall settings and rules to make it easy to restore (import) them all at once as needed.
Reference:
Firewall and Network Protection in the Windows Security App - Microsoft Support
Learn how to turn the Windows Firewall on or off using the Windows Security app.
You must be signed in as an administrator to backup and restore Microsoft Defender Firewall settings and rules.
Contents
- Option One: Backup and Restore Microsoft Defender Firewall Settings and Rules in Advanced Security
- Option Two: Backup (export) Microsoft Defender Firewall Settings and Rules using Command
- Option Three: Restore (import) Microsoft Defender Firewall Settings and Rules using Command
1 Open Windows Security.
2 Click/tap on Firewall & network protection. (see screenshot below)
3 Click/tap on the Advanced Settings (wf.msc) link. (see screenshot below)
4 If prompted by UAC, click/tap on Yes to approve elevation.
5 Do step 6 (backup) or step 7 (restore) below for what you want.
6 Backup Microsoft Defender Firewall Settings and Rules
A) Perform either action below: (see screenshot below)
- Select Windows Defender Firewall with Advanced Security on Local Computer in the left pane, and click/tap on Export Policy in the right "Actions" pane.
- Select Windows Defender Firewall with Advanced Security on Local Computer in the left pane, click/tap on Action on the toolbar, and click/tap Export Policy.
- Right click on Windows Defender Firewall with Advanced Security on Local Computer in the left pane, and click/tap Export Policy.
B) Navigate to where you want to export the .wfw file, type a file name you want, and click/tap on Save. (see screenshot below)
C) Click/tap on OK. (see screenshot below)
7 Restore Microsoft Defender Firewall Settings and Rules
A) Perform either action below: (see screenshot below)
- Select Windows Defender Firewall with Advanced Security on Local Computer in the left pane, and click/tap on Import Policy in the right "Actions" pane.
- Select Windows Defender Firewall with Advanced Security on Local Computer in the left pane, click/tap on Action on the toolbar, and click/tap Import Policy.
- Right click on Windows Defender Firewall with Advanced Security on Local Computer in the left pane, and click/tap Import Policy.
B) Click/tap on Yes to confirm. (see screenshot below)
C) Navigate to and select the .wfw file you want to import, and click/tap on Open. (see screenshot below)
D) Click/tap on OK (see screenshot below)
1 Open Windows Terminal (Admin), and select either Windows PowerShell or Command Prompt.
2 Copy and paste the appropriate command below into Windows Terminal (Admin), and press Enter. (see screenshot below)
Command Prompt
netsh advfirewall export "%userprofile%\Desktop\WindowsFirewallSettingsBackup.wfw"OR
Windows PowerShell
netsh advfirewall export "$Env:USERPROFILE\Desktop\WindowsFirewallSettingsBackup.wfw"3 You will now have a WindowsFirewallSettingsBackup.wfw file saved to your desktop that is the backup of your firewall settings and rules. You can rename and/or move this file to where you like to keep it saved at.
4 When finished, you can close Windows Terminal (Admin) if you like.
1 Open Windows Terminal (Admin), and select either Windows PowerShell or Command Prompt.
2 Type the command below into Windows Terminal (Admin), and press Enter. (see screenshot below)
netsh advfirewall import "Full path of .wfw file"Substitute Full path of .wfw file in the command above with the actual full path of the exported .wfw file.
For example: netsh advfirewall import "C:\Users\Brink\Desktop\WindowsFirewallSettingsBackup.wfw"
3 When finished, you can close Windows Terminal (Admin) if you like.
That's it,
Shawn Brink
Last edited:











