Answered by:
Some 'netsh advfirewall firewall' commands.

Question
-
Hi everyone!
May someone help me on some 'netsh advfirewall firewall' commands:
- How do I disable all rules?
- Is there a reset command to delete and recreate the default rules?
Thanks
Doria
Monday, July 20, 2020 12:40 PM
Answers
-
Hi,
Please find the cmd here:
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.
- Edited by CherryZhang2020Microsoft contingent staff Tuesday, July 21, 2020 2:35 AM
- Marked as answer by dydoria Tuesday, July 21, 2020 4:53 PM
Tuesday, July 21, 2020 2:35 AM
All replies
-
Hi,
Please find the cmd here:
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.
- Edited by CherryZhang2020Microsoft contingent staff Tuesday, July 21, 2020 2:35 AM
- Marked as answer by dydoria Tuesday, July 21, 2020 4:53 PM
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.
- Edited by CherryZhang2020Microsoft contingent staff Thursday, July 23, 2020 2:10 AM
Thursday, July 23, 2020 2:09 AM