CMD Window Script to open Windows Firewall Ports for SQL Server

How to open the firewall port for SQL Server on Windows Server 2008 using a CMD Window
Moving an older Windows 2008 VM and needed to find a replacement script of my PowerShell to open the firewall port for SQL Server as the one and done Power Shell SQL firewall open ports was not working here is one which uses the netsh command to open the Windows firewall for most ALL ports for SQL Server related Services.

Most importantly everything starts with "SQL" and contains the port number in the description which is easier to see in the Windows FireWall rules if they at anything are needed to be disabled or enabled:

Enjoy!


@echo ========= SQL Server Ports ===================
@echo Enabling SQL Server default instance port 1433
netsh firewall set portopening TCP 1433 "SQL Server 1433"
@echo Enabling Dedicated Admin Connection port 1434
netsh firewall set portopening TCP 1434 "SQL Admin Connection 1434/Browser Service when you are using named instances"
@echo Enabling conventional SQL Server Service Broker port 4022
netsh firewall set portopening TCP 4022 "SQL Service Broker 4022"
@echo Enabling Transact-SQL Debugger/RPC port 135
netsh firewall set portopening TCP 135 "SQL Debugger/RPC 135"
@echo ========= SQL Mirror and Availability Groups==============
@echo Enabling SQL Database Mirroring port 5022
netsh firewall set portopening TCP 5022 "SQL Database Mirroring 5022"
@echo Enabling SQL Availability Group port 5023
netsh firewall set portopening TCP 5023 "SQL Availability Group 5023"
@echo ========= Analysis Services Ports ==============
@echo Enabling SSAS Default Instance port 2383
netsh firewall set portopening TCP 2383 "SQL Analysis Services 2383"
@echo Enabling SQL Server Browser Service port 2382
netsh firewall set portopening TCP 2382 "SQL Browser 2382"
@echo ========= Misc Applications ==============
@echo Enabling HTTP port 80
netsh firewall set portopening TCP 80 "SQL Reporting Services Web Services HTTP 80"
@echo Enabling SSL port 443
netsh firewall set portopening TCP 443 "SQL Reporting Services configured for use through HTTPS SSL 443"
@echo Enabling port for SQL Server Browser Service's 'Browse' Button
netsh firewall set portopening UDP 1434 "SQL Server Browser service for named instances"


Link to Microsoft KB968872 “How to open the firewall port for SQL Server on Windows Server 2008”

Comments

Popular posts from this blog

How to mass update all or some sql server agent job step commands

SQL Monitoring for Blocking and Locking Capture and Log to table with sp_WhoIsActive or sp_BlitzWho

SQL Server General Index Naming Convention