Use netsh advfirewall to Add windows 7 firewall exception

Oren picture Oren · Jan 2, 2011 · Viewed 12.7k times · Source

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

Answer

nbozovic picture nbozovic · Dec 14, 2011

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"