- 💠 Dumps ALL ("Allow") Firewall Rules from Windows Defender Firewall with Advanced Security.
- 💠 Reconverts them into applicables one through "netsh advfirewall firewall add rule".
- 💠 Will get dumped & converted in: %USERPROFILE%\Rules\FWCommands.txt
- 💠 Prompts user to open the dump/rules location, for analysis/learning/re-apply/backups.
- Right-click the script, run in PowerShell 🔂
Get-Rules Block 🎦
- Creates the Rules folder in %USERPROFILE%\Rules if not present
- Dumps all "allowed" firewall rules into a textfile at %USERPROFILE%\Rules\FW-Rules.txt
- Stock the rules into a variable from the file dumped (user can use custom file/path)
- Parse each rules ending at '(?<=Action: Allow)'
- Create a .txt of each rules at %USERPROFILE%\Rules$i.txt
- Increment until none left
Conversion (Rules, Groups) 🔄
- Gets the last item of the rules dumped, then starts the loop until last rule
- Starting from rule #1, it'll extract all rule's parameters into variables
- Then create a netsh command to re-enter it as needed, with rule's variables
- Each set of variables creates a command which is added to a command file
- Final textfile contains all commands ready to be applied, in the 'netsh' format.
I created this dumper to easily re-create multiple rules I needed. Be sure to note the packages or you may be missing some stuff, lemme know if anything is wrong! With the "Export Policy" option, you can't select which to export/import, (like the predefined firewall rules) you have to overwrite the whole set ❌