Windows 10 | regedit | exefile shell command (firewall add rule) - not running

浪尽此生 提交于 2019-12-23 03:12:13

问题


Definitions:

  1. using windows 10/64bit
  2. firewall is blocking all in/out traffic - except added rules (allow in/out)
  3. actual user-account is administrator
  4. tested with all user-account-control (uac) settings: from always to never

Problem:

I have a script that worked fine with windows 7/64 bit, it adds right-click context menu items to .exe files, to add a firewall rule for them:

Windows Registry Editor Version 5.00 
[HKEY_CLASSES_ROOT\exefile\shell]
[HKEY_CLASSES_ROOT\exefile\shell\FirewallAllowIncoming]
[HKEY_CLASSES_ROOT\exefile\shell\FirewallAllowIncoming\command]
@="netsh advfirewall firewall add rule name=\"%1\" dir=in action=allow program=\"%1\""
[HKEY_CLASSES_ROOT\exefile\shell\FirewallAllowOutgoing]
[HKEY_CLASSES_ROOT\exefile\shell\FirewallAllowOutgoing\command]
@="netsh advfirewall firewall add rule name=\"%1\" dir=out action=allow program=\"%1\""

it does not work in Windows 10.

Troubleshooting so far:

following command is working in command prompt (cmd.exe) if running as Administrator:

netsh advfirewall firewall add rule name=\"TEST\" dir=out action=allow program=\"C:\TEST.EXE\"

If not running cmd.exe as Adminstrator, it does not work and it shows a message, that i have to run as Adminstrator.

I believe, it has something to do with the uac - and if the right click context menu commands are clicked, they are not running as administrator and are not executed.

Any suggestions? Thank you.

来源:https://stackoverflow.com/questions/45896479/windows-10-regedit-exefile-shell-command-firewall-add-rule-not-running

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!