-
-
Save jnaskali/5936789 to your computer and use it in GitHub Desktop.
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'`\\\"\\\"\"" |
this looked like a godsend... but sadly clicking Firewall Unblock does not add anything to the firewall outbound or inbound rules.
OS Windows 10 Pro v1607 64 bit
@Wolverine1977: Try this method to create submenu:
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 In Windows Firewall"
"icon"="%SystemRoot%\\system32\\FirewallControlPanel.dll,1"
[HKEY_CLASSES_ROOT\exefile\shell\WindowsFirewall\Shell\block\command]
@="cmd.exe /s /c for %%a in (\"%1\") do netsh advfirewall firewall add rule name=\"Block %%~na\" dir=out action=block program=\"%1\""
[HKEY_CLASSES_ROOT\exefile\shell\WindowsFirewall\Shell\Remove]
@=""
"MUIVerb"="Remove From Windows Firewall"
"icon"="%SystemRoot%\\system32\\FirewallControlPanel.dll,2"
[HKEY_CLASSES_ROOT\exefile\shell\WindowsFirewall\Shell\Remove\command]
@="cmd.exe /s /c for %%a in (\"%1\") do netsh advfirewall firewall delete rule name=\"Block %%~na\""
No Fixed UAC permissions if UAC is enabled. You can try fix with run as / powershell / trid-party software / disable UAC.
but sadly clicking Firewall Unblock does not add anything to the firewall (...) rules.
The command delete rule, no change / add new (blocking is more important than allow).
Maybe UAC block remove rule to firewall, I see access is denied
. You can try fix with run as / powershell / trid-party software / disable UAC.
Thats the one that worked for me
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\exefile\shell\firewallblock]
@="Add to Firewall"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\exefile\shell\firewallblock\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\firewallremove]
@="Remove from Firewall"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\exefile\shell\firewallremove\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'
\"\"""
It took some time before i manage to get this to work. Many chars are removed because it was not included in three backticks.
Here is a complete and working file. I have added "Extended"=""
.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\exefile\shell\firewallblock]
@="Add to Firewall"
"HasLUAShield"=""
"Extended"=""
[HKEY_CLASSES_ROOT\exefile\shell\firewallblock\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\firewallremove]
@="Remove from Firewall"
"HasLUAShield"=""
"Extended"=""
[HKEY_CLASSES_ROOT\exefile\shell\firewallremove\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)
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
Can you please explain how to add the block and remove commands to a submenu. e.g. I would like a Context menu called Security Tools and have the block and block remove under that Security Tools menu, also is it possible to assign a custom icon to the commands rather than the UAC shield?
Great Reg Edit - Thanks