Configure SQL Server ports via Powershell

SQL Server - Configure the firewall ports

These short lines allow you to configure the necessary ports for commissioning a SQL Server.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

# Enable ports for SQL Server
New-NetFirewallRule -DisplayName "SQL Admin Connection" -Direction Inbound -Protocol TCP -LocalPort 1434 -Action allow
New-NetFirewallRule -DisplayName "SQL Server" -Direction Inbound -Protocol TCP -LocalPort 1433 -Action allow
New-NetFirewallRule -DisplayName "SQL Debugger / RPC" -Direction Inbound -Protocol TCP -LocalPort 135 -Action allow
New-NetFirewallRule -DisplayName "SQL Database Management" -Direction Inbound -Protocol UDP -LocalPort 1434 -Action allow
New-NetFirewallRule -DisplayName "SQL Service Broker" -Direction Inbound -Protocol TCP -LocalPort 4022 -Action allow

# Enable ports for SQL Analysis
New-NetFirewallRule -DisplayName "SQL Browser" -Direction Inbound -Protocol TCP -LocalPort 2382 -Action allow
New-NetFirewallRule -DisplayName SQL Analysis Services -Direction Inbound -Protocol TCP -LocalPort 2383 -Action allow

# Enable additional ports
New-NetFirewallRule -DisplayName "SQL Server Browse Button Service" -Direction Inbound -Protocol UDP -LocalPort 1433 -Action allow
New-NetFirewallRule -DisplayName "HTTP" -Direction Inbound -Protocol TCP -LocalPort 80 -Action allow
New-NetFirewallRule -DisplayName "SSL" -Direction Inbound -Protocol TCP -LocalPort 443 -Action allow

# Set the settings for the default behavior
Set-NetFirewallProfile -DefaultInboundAction Block -DefaultOutboundAction Allow -NotifyOnListen True -AllowUnicastResponseToMulticast True

# Additional Information
https://docs.microsoft.com/de-de/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access?view=sql-server-ver15

Configure SQL Server ports via Powershell

Ashampoo® Backup Pro 14