问题
Hi I am adding a firewall exception to Windows 7 using netsh. The simple rule i am adding is:
netsh advfirewall firewall add rule name = "The Test App3" dir = in action = allow description = "Smart Cipher inbound messages" program = "C:\temp\a.exe"
The problem is that after executing this command a new rule is added to the firewall and is displayed within the firewall console - but it seems it is not properly configured for two reasons: 1. The Remove button in the firewall console is disabled 2. Clicking the Details... button show no details for the rule, unlike other "good rules", but only name and description
Please advice
Tx
Oren
回答1:
added only profiles arguments to yours command line also removed all those spaces ...="... all works fine.
ps: Vikram.exe: default is enabled=yes (true)
here is what I got at the end:
netsh advfirewall firewall add rule name="Visaris Diagon 3.1 Administration" dir=in action=allow profile=any description="Visaris Diagon 3.1 Administration" program="C:\Program Files (x86)\Visaris\Visaris Diagon 3.1\Visaris.Diagon.Administration.exe"
netsh advfirewall firewall add rule name="Visaris Diagon 3.1 Administration" dir=out action=allow profile=any description="Visaris Diagon 3.1 Administration" program="C:\Program Files (x86)\Visaris\Visaris Diagon 3.1\Visaris.Diagon.Administration.exe"
回答2:
Try adding the "enable" sub command and removing the spaces
eg:
netsh advfirewall firewall add rule name="The Test App3" dir=in action=allow
description="Smart Cipher inbound messages" program="C:\temp\a.exe" enable=yes
来源:https://stackoverflow.com/questions/4579643/use-netsh-advfirewall-to-add-windows-7-firewall-exception