New
#1
Add context menu to Windows 10 to add firewall rule (elevated)...
I'm trying to achieve what was trivial in Windows 7 using the following registry entries:
[HKEY_CLASSES_ROOT\exefile\shell\Add to Firewall\command]
@="netsh advfirewall firewall add rule name=\"%1\" dir=out action=block program=\"%1\""
[HKEY_CLASSES_ROOT\exefile\shell\Remove from Firewall\command]
@="netsh advfirewall firewall delete rule name=\"%1\""
Everything seems fine except that no rule is added.
Apparently I need admin privileges which I have (Administrator account is active), but Windows ignores this. I can add a rule with no issues, if I run the netsh-command in an elevated command prompt.
I need to run the commands without Windows asking for a password (the "runas /Administrator 'command'" will ask for the password).
I read somewhere that "For a context menu command to be executed As Administrator(Elevated) you have to put the command under the special verb RunAs like:[HKEY_CURRENT_USER\Software\Classes\Directory\shell\runas\command]".
How do the keys need to look so that the command will work as in Windows 7?
Thanks,
/Søren