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.