locked
Some 'netsh advfirewall firewall' commands. RRS feed

  • Question

  • Hi everyone!

      May someone help me on some 'netsh advfirewall firewall' commands:

    1. How do I disable all rules?
    2. Is there a reset command to delete and recreate the default rules?

    Thanks


    Doria

    Monday, July 20, 2020 12:40 PM

Answers

All replies

  • Hi,

    Please find the cmd here:

    https://support.microsoft.com/en-us/help/947709/how-to-use-the-netsh-advfirewall-firewall-context-instead-of-the-netsh

    This "Server Core" Forum will be migrating to a new home on Microsoft Q&A, please refer to this sticky post for more details.

    Best regards

    Cherry


    "Windows Server 2012 General" forum will be migrating to a new home on Microsoft Q&A!

    We invite you to post new questions in the "Windows Server 2012 General"  forum's new home on Microsoft Q&A!

    For more information, please refer to the sticky post.


    Tuesday, July 21, 2020 2:35 AM
  • Excellent material!

    Thank you!


    Doria

    Tuesday, July 21, 2020 4:54 PM
  • Hi team!

      Well, I'm done with those commands. It seems to do what I want, that is, to deny any connection except from my station and specific application servers. What do you think?

      netsh advfirewall reset
      netsh advfirewall set allprofiles state off
      netsh advfirewall set domainprofile state on
    
      netsh advfirewall set currentprofile logging filename C:\dump\logs\pfirewall.log
      netsh advfirewall set currentprofile logging maxfilesize 4096
      netsh advfirewall set currentprofile logging droppedconnections enable
      netsh advfirewall set currentprofile logging allowedconnections enable
    
      netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv4-In)" new enable=yes
      netsh advfirewall firewall add rule name="Allow from my station" dir=in action=allow protocol=any remoteip=%1
      netsh advfirewall firewall add rule name="Allow from 192.168.0.x server port 1433" dir=in action=allow protocol=TCP localport=1433 remoteip=192.168.0.x
    

    Regards.


    Doria

    Wednesday, July 22, 2020 3:20 PM
  • Hi,

    Thanks for your posting here and sharing the resolution in the forum as it would be helpful to anyone who encounters similar issues.
    If there is anything else we can do for you, please feel free to post in the forum.

    This "Server Core" Forum will be migrating to a new home on Microsoft Q&A, please refer to this sticky post for more details.

    Best regards

    Cherry


    "Windows Server 2012 General" forum will be migrating to a new home on Microsoft Q&A!

    We invite you to post new questions in the "Windows Server 2012 General"  forum's new home on Microsoft Q&A!

    For more information, please refer to the sticky post.


    Thursday, July 23, 2020 2:09 AM