Change all firewall rules to apply to domain profile only

Posted by

Does your firewall rules look like this? Some rules applies to all profiles and some to some others?

image

If you need to streamline the rules to just apply to one profile, PowerShell is your friend here!

Use the following PowerShell command to list all the rules that are enabled

Get-NetFirewallRule -Enabled True

To change a profile for a specific rule the command for this is

Set-NetFirewallRule -Name “Rule Name” -Profile “Private,Domain”

But what about changing all of them? Easy just type and it will enumerate all your enabled rules and apply only to Domain profile

Get-NetFirewallRule -Enabled True | Set-NetFirewallRule -Profile Domain

image

2 comments

  1. Hello, thanks for this post.

    If I want to bulk change the profile type of enabled rules to “All” instead of “Domain” or “Private”, what would be the command?

    Also, iIs there a way to get/select all enabled rules with a certain action (for example “Block” or “Allow”) and then bulk change their profile type to “All”?

    Thank you so much in advance!!

    Like

    1. Hi there!
      I think you are looking for the PS command
      Get-NetFirewallRule -Enabled True | Set-NetFirewallRule -Profile Any

      this will change the profile to Any for all enabled FW rules

      Like

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.