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

Advertisements

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 )

Google photo

You are commenting using your Google 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.