Use netsh advfirewall firewall instead of netsh firewall to control Windows Firewall behavior
This article describes how to use the netsh advfirewall firewall context instead of the netsh firewall context to control Windows Firewall behavior.
Applies to: Windows Server 2012 R2
Original KB number: 947709
Summary
The netsh advfirewall firewall command-line context is available in Windows Server 2012 R2. This context provides the functionality for controlling Windows Firewall behavior that was provided by the netsh firewall firewall context.
This context also provides functionality for more precise control of firewall rules. These rules include the following per-profile settings:
- Domain
- Private
- Public
The netsh firewall command-line context might be deprecated in a future version of the Windows operating system. We recommend that you use the netsh advfirewall firewall context to control firewall behavior.
Important
If you are a member of the Administrators group, and User Account Control is enabled on your computer, run the commands from a command prompt with elevated permissions. To start a command prompt with elevated permissions, find the icon or Start menu entry that you use to start a command prompt session, right-click it, and then click Run as administrator.
Some examples of frequently used commands are provided in the following tables. You can use these examples to help you migrate from the older netsh firewall context to the new netsh advfirewall firewall context.
Additionally, the netsh advfirewall commands that you can use to obtain detailed inline help are provided.
Command example 1: Enable a program
For more information about how to add firewall rules, run the following command:
netsh advfirewall firewall add rule ?Command example 2: Enable a port
For more information about how to add firewall rules, run the following command:
Consolenetsh advfirewall firewall add rule ?Command example 3: Delete enabled programs or ports
For more information about how to delete firewall rules, run the following command:
cosnolenetsh advfirewall firewall delete rule ?Command example 4: Configure ICMP settings
For more information about how to configure ICMP settings, run the following command:
Consolenetsh advfirewall firewall add rule ?Command example 5: Set logging
For more information, run the following command:
Consolenetsh advfirewall set currentprofile ?If you want to set logging for a particular profile, use one of the following options instead of the
currentprofileoption:
DomainprofilePrivateprofilePublicprofileCommand example 6: Enable Windows firewall
For more information, run the following command:
Consolenetsh advfirewall set currentprofile ?If you want to set the firewall state for a particular profile, use one of the following options instead of the
currentprofileoption:
DomainprofilePrivateprofilePublicprofileCommand example 7: Restore policy defaults
For more information, run the following command:
Consolenetsh advfirewall reset ?Command example 8: Enable specific services
Source:https://docs.microsoft.com/en-US/troubleshoot/windows-server/networking/netsh-advfirewall-firewall-control-firewall-behavior#top
Nenhum comentário:
Postar um comentário