I want to add some rules to inbound connection of my win 2012 server. All the rules should apply to a group of ip addresses.

It looks like the firewall supports groups of IP (predefined groups) but - I can't find the way to define a new group and set it's member's ip.

How can it be done if at all ?


I don't think you can create custom lists of IP addresses and use them in multiple rules. The Windows Firewall is still lacking features compared to proper Firewall products.

However, one workaround would be to define your custom lists in PowerShell and then apply them to the rules:

 $List1 = @("","","")
 $List2 = @("")

 Set-NetFirewallRule -Name "IIS-WebServerRole-HTTP-In-TCP" -RemoteAddress $List1
 Set-NetFirewallRule -Name "FPS-ICMP4-ERQ-In" -RemoteAddress $List1
 Set-NetFirewallRule -Name "CoreNet-DHCPV6-Out" -RemoteAddress $List2

You just define an string array of addresses, or subnets. Then you set the scope using the Set-NetFirewallRule cmdlet.

If you want to add or remove an address, just change the list definition at the top and run the script again.

You could also save the list definition in a text-file or Excel-sheet, rather than in the script itself.

The script then also serves as a nice documentation of your Firewall rules.

You can use the PowerShell Filewall cmdlets to manage all aspects of the Windows Firewall.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.