Last active
March 2, 2025 17:10
-
-
Save jnaskali/5936789 to your computer and use it in GitHub Desktop.
Block/Unblock exe in Windows Firewall using right-click menu (updated thanks to ghjbnm's comment below)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\exefile\shell\WindowsFirewall] | |
@="" | |
"MUIVerb"="Windows Firewall" | |
"icon"="%SystemRoot%\\system32\\FirewallControlPanel.dll,0" | |
"subcommands"="" | |
[HKEY_CLASSES_ROOT\exefile\shell\WindowsFirewall\Shell] | |
@="" | |
[HKEY_CLASSES_ROOT\exefile\shell\WindowsFirewall\Shell\block] | |
@="" | |
"MUIVerb"="Block" | |
"icon"="%SystemRoot%\\system32\\FirewallControlPanel.dll,1" | |
[HKEY_CLASSES_ROOT\exefile\shell\WindowsFirewall\Shell\block\command] | |
@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -Executionpolicy ByPass -WindowStyle Hidden -NoLogo -Command \"start powershell -Verb runas -ArgumentList \\\"-NoLogo -WindowStyle Hidden -command `\\\"New-NetFirewallRule -DisplayName ([System.IO.Path]::GetFilenameWithoutExtension('%1')) -Name '%1' -Enabled True -Direction Outbound -Action Block -Program '%1'`\\\"\\\"\"" | |
[HKEY_CLASSES_ROOT\exefile\shell\WindowsFirewall\Shell\Remove] | |
@="" | |
"MUIVerb"="Allow" | |
"icon"="%SystemRoot%\\system32\\FirewallControlPanel.dll,2" | |
[HKEY_CLASSES_ROOT\exefile\shell\WindowsFirewall\Shell\Remove\command] | |
@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -Executionpolicy ByPass -WindowStyle Hidden -NoLogo -Command \"start powershell -Verb runas -ArgumentList \\\"-NoLogo -WindowStyle Hidden -command `\\\"Remove-NetFirewallRule -Name '%1'`\\\"\\\"\"" |
Following worked for me (Windows 10 Build 1909)
I updated the gist using your solution. Thanks!
jnaskali
Any chance of including the update DATE in the gist when you change it?
22h2 it does not work for me...
22h2 it does not work for me...
Same. Not working. I have no clue how to fix it. I tried to tweak it, but no success.
22h2 it does not work for me...
Same. Not working. I have no clue how to fix it. I tried to tweak it, but no success.
ive found easy context menu, it make this and work
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Following worked for me (Windows 10 Build 1909)