Would you like to learn how to open a TCP port on the Windows Firewall using the Powershell? In this tutorial, we are going to show you how to use Powershell to create a firewall rule to open a port on Windows.
• Windows 2012 R2
• Windows 2016
• Windows 2019
• Windows 10
• Windows 7
Equipment list
The following section presents the list of equipment used to create this tutorial.
As an Amazon Associate, I earn from qualifying purchases.
Related tutorial – PowerShell
On this page, we offer quick access to a list of tutorials related to PowerShell.
Tutorial Firewall – Open a TCP port using Powershell
As an Administrator, start an elevated Powershell command-line.
Create a firewall rule to open a TCP port using Powershell.
Here is the command output:
Verify the created firewall rule.
Here is the command output:
In our example, we created a firewall rule to allow the input on the TCP port 80 using Powershell.
Create a firewall rule to allow the input to multiple TCP ports.
Here is the command output:
Verify the created firewall rule.
Here is the command output:
In our example, we created a firewall rule to open multiple TCP ports using Powershell.
Congratulations! You are able to create a firewall rule to open a TCP port using the Powershell on Windows.
Tutorial Firewall – Open a UDP port using Powershell
As an Administrator, start an elevated Powershell command-line.
Create a firewall rule to open a UDP port using Powershell.
Here is the command output:
Verify the created firewall rule.
Here is the command output:
In our example, we created a firewall rule to allow the input on the UDP port 53 using Powershell.
Create a firewall rule to allow the input to multiple UDP ports.
Verify the created firewall rule.
Here is the command output:
In our example, we created a firewall rule to open multiple UDP ports using Powershell.
Congratulations! You are able to create a firewall rule to open a UDP port using the Powershell on Windows.
Tutorial Powershell – Managing the firewall service
As an Administrator, start an elevated Powershell command-line.
Configure the Windows firewall service to start automatically.
Start the Windows firewall service.
Enable the Windows firewall profiles.
Congratulations! You are able to manage the Firewall service using Powershell.