1

I am trying to establish a firewall rule that allows incoming traffic to my application. However, the rule does not appear to be allowing the traffic as desired. I am using netsh to establish the rule, but when I specify the path to my program the rule appears to not allow the traffic as desired.

netsh advfirewall firewall add rule name="My Application Rule" 
    program="C:\Program Files (x86)\MyComp\MyApp\MyApp.exe" dir=in action=allow
    protocol=TCP localport=7890-7894

When I do not specify the program the traffic is allowed, however, this is not desired because it'll allow traffic to any application listening on those ports.

netsh advfirewall firewall add rule name="My Application Rule" dir=in
    action=allow protocol=TCP localport=7890-7894

migrated from serverfault.com Feb 26 '14 at 19:25

This question came from our site for system and network administrators.

  • Take note that if you are using GUI for this task, it's either localport or program, not both. – Kitet Feb 18 '14 at 20:23
  • @Kitet I have used both the GUI and command line to add the desired rule with the same results each time. – JG in SD Feb 18 '14 at 20:39
  • So MyApp.exe is certainly not the right App. It could be a sub-process of MyApp.exe. What is MyApp.exe ? a real App or a custom dev ? You could check what happens with Wireshark. – user2196728 Feb 18 '14 at 23:44
  • @user2196728 MyApp.exe is a .NET application that I work on. My end goal is to figure out what commands I need to run via the command line in the installer, so network traffic can reach the program without an administrator needing to configure the firewall manually. – JG in SD Feb 19 '14 at 2:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.