Command line configure Windows Advanced Firewall

Just to see the message today asking how to configure the firewall policy line in the remote IP address through the command, in particular, to add a new address.
Command line configure Windows Advanced Firewall
Scope is the address of the figures in the Remote IP address.

The first reaction is used to try to configure netsh firewall. After entering the command, find the best tips to use Windows powershell configuration, after the system is configured in this way is no longer available. It seems that Microsoft is gradually put all the configuration commands are turning to the Powershell. If you do not see the picture, please point me .
Command line configure Windows Advanced Firewall

So we must turn powershell commands.

New-NetFirewallRule -DisplayName testrule -Direction Inbound -Action Allow -LocalPort 333 -Protocol TCP -RemoteAddress 192.168.1.0/24,172.16.0.0/16

Command line configure Windows Advanced Firewall

Next you can view the details of the remote address command

Get-NetFirewallRule -DisplayName testrule | Get-NetFirewallAddressFilter
Command line configure Windows Advanced Firewall

Because with get-netfirewallrule | fl can not get all the configuration information, you must get to see the variety of all kinds of filter configuration information later.

Well, if you need to modify the IP address of the remote, you need to obtain the current configuration, and then use the Set-NetFirewallRule command to update RemoteAddress.

I hope this article can play a valuable role, to help you flexibly configure the Windows Advanced Firewall.

Guess you like

Origin blog.51cto.com/qiyuwei/2416270