Open Or Block Firewall Ports On Windows Nano Server 2016 Using PowerShell

Yesterday I showed you how to Manage The Firewall On Windows Nano Server 2016 and today I’ll show how to open ports In Nano Server 2016.

By default Nano Server 2016 comes with the Firewall enabled and most ports are blocked, that’s why In my build articles I tell people to disable it first until setup Is done.

To get started, I’ll show you to examples on how to Enable ICMP (ping) and Http connection to IIS.

The first step In this process Is to connect to the Nano Server using PowerShell.

Once connected use the cmdlets below to Open \ Block ports.

#Disable Ping

Set-NetFirewallRule -Name FPS-ICMP4-ERQ-In -Enabled False

Set-NetFirewallRule -Name FPS-ICMP4-ERQ-out -Enabled False
#Enable Ping

Set-NetFirewallRule -Name FPS-ICMP4-ERQ-In -Enabled True

Set-NetFirewallRule -Name FPS-ICMP4-ERQ-out -Enabled True
#Disable Http

Set-NetFirewallRule -Name IIS-WebServerRole-HTTP-In-TCP -Enabled False

Set-NetFirewallRule -Name IIS-WebServerRole-HTTPS-In-TCP -Enabled False
#Enable Http

Set-NetFirewallRule -Name IIS-WebServerRole-HTTP-In-TCP -Enabled True

Set-NetFirewallRule -Name IIS-WebServerRole-HTTPS-In-TCP -Enabled True

To view all Rules use:

Get-NetFirewallRule |ft


Posted

in

by