Skip to content

Instantly share code, notes, and snippets.

@rahman541
Created March 26, 2019 20:41
Show Gist options
  • Save rahman541/309c37d6e25044b9f3f3a5b13b1e873e to your computer and use it in GitHub Desktop.
Save rahman541/309c37d6e25044b9f3f3a5b13b1e873e to your computer and use it in GitHub Desktop.
; Block executable from internet access with Windows Firewall
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\exefile\shell]
[HKEY_CLASSES_ROOT\exefile\shell\Firewall: Add]
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\exefile\shell\Firewall: Add\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd -ArgumentList '/s,/k,pushd && netsh advfirewall firewall add rule name=\\\"%1\\\" dir=out action=block program=\\\"%1\\\" & pause & exit' -Verb RunAs\""
[HKEY_CLASSES_ROOT\exefile\shell\Firewall: Delete]
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\exefile\shell\Firewall: Delete\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd -ArgumentList '/s,/k,pushd && netsh advfirewall firewall delete rule name=\\\"%1\\\" & pause & exit' -Verb RunAs\""
; Uninstall - Block executable from internet access with Windows Firewall
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\exefile\shell\Firewall: Add]
[-HKEY_CLASSES_ROOT\exefile\shell\Firewall: Delete]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment