Answered netsh firewall - Retail LAN

  • Tuesday, February 21, 2012 4:33 AM
     
     

    Hi all,

            Just would like to try and find out what is the proper command sequence I need to use for setting up a Windows Firewall batch script for retail stores (I work for a Point of Sale Hardware/Software Vendor)

    Currently my command string for the section thats holding me up is as follows:

    FOR /L %I%I IN (8030,1,8043) DO netsh firewall add portopening UDP %I%I "Logivision"%I%I ENABLE CUSTOM 192.168.140.0/24,192.168.140.0/255.255.255.0,LocalSubnet
    netsh firewall add portopening UDP 9031 Logivision9031 ENABLE CUSTOM 192.168.140.0/24,192.168.140.0/255.255.255.0,LocalSubnet

    This is the rule I need to create to enable the ports 8030 through 8043 through the firewall, while restricting it to the local subnet listed. I think I had it run once, but it seems this rule wont work on Windows Server 2003/2008, but has worked on Windows XP (ONCE, lol). The extra rule after it is also another one which I know will work, but this shows you the ports I need to allow through

    Hows the best way I can go about this?

    Suggestions/inputs appreciated :)

    Regards

All Replies

  • Tuesday, February 21, 2012 6:20 AM
     
     

    netsh ADVFIREWALL

    o.

  • Tuesday, February 21, 2012 9:24 AM
    Moderator
     
     

    Hi,

    Thank you for your post.

    Agree with Ondrej Sevecek, please use "netsh advfirewall firewall" instead of "netsh firewall".
    More details, please read KB949543 and KB947709.

    If there are more inquiries on this issue, please feel free to let us know.

    Regards


    Rick Tan

    TechNet Community Support

  • Wednesday, February 22, 2012 12:28 AM
     
     

    Thanks for your replies all

    I will give that a whirl and see how it goes and report back in a short while if its all worked

  • Wednesday, February 22, 2012 12:41 AM
     
     

    That was negative. The server I am developing this firewall on did not like that. Came up and told me that advfirewall was not found

    I just need to finish ironing out the bugs with this as well deploy to sites with a variety of OS's (Windows XP, Windows Server 2003 & Server 2008)

    I've got most of the issues worked out, but its the little niggling ones that I cant work out, lol

    My test server runs the following:

    Windows Server 2003 Standard Edition SP2

    Here's a pastebin dump of my systeminfo if its any help

    http://pastebin.com/dvB5eRiB

    With the command I listed to try and get it to add the ports automatically for me, it just keeps coming back to me telling me I is undefined at this time

    • Edited by Nutterpc Wednesday, February 22, 2012 12:50 AM
    •  
  • Wednesday, February 22, 2012 8:29 AM
    Moderator
     
     Answered

    Hi,

    I test the command on Windows 2003 SP2, works change all %I%I to %I.

    FOR /L %I IN (8030,1,8043) DO netsh firewall add portopening UDP %I "Logivision"%I ENABLE CUSTOM 192.168.140.0/24,192.168.140.0/255.255.255.0,LocalSubnet

    Regards


    Rick Tan

    TechNet Community Support


  • Wednesday, February 22, 2012 10:43 PM
     
     Answered

    Thanks rick.

    I gave that a shot, still didnt seem to like me, I dont know why

    But I just ended up creating the lines manually :) didnt want to, but will save hassle in the end