Create a new firewall rule with Powershell

Sometimes you just want a new firewall rule, you know that it doesn’t conflict with anything else and you want it simple.

The solution ? Powershell. Many other pages explain the powershell commands for managing the firewall in detail. For me, that made it harder to memorize what I was actually looking for, so I had to look it up the next time as well. So I decided to write down the simplest of all on this page.

This command will create a new firewall rule allowing incoming TCP connections on port 80 for all profiles:

New-NetFirewallRule -Name allowTcp80 -DisplayName "Allow Inbound Port 80" –LocalPort 80 -Protocol TCP

If you omit -Name a GUID will be assigned as the rule name. When you create a name yourself, it will be easier if you want to do more management from Powershell.

Advertisements

Leave a Reply

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: