Here’s a nice tip for those that for some reason need to configure Windows Firewall (or Windows Defender Firewall on Windows 10).
The recommended way to do this should be using a group policy but because you may have a non-domain joined machine on your network, here’s how to do it.
- First of all, configure everything you need in Windows Firewall on a reference machine
- Then, open an elevated command-prompt and type the following command:
netsh advfirewall export “C:\Temp\WindowsFirewallRules.wfw”
- Now that you have the file, you can import it to any machine using the following command:
netsh advfirewall import “C:\Temp\WindowsFirewallRules.wfw”
If for any reason you need to reset firewall rules to default values just type:
netsh advfirewall reset