/Config-MECMFirewallPorts.ps1 Secret
Created
June 18, 2023 00:08
Star
You must be signed in to star a gist
This script opens specific ports in the Windows Firewall to allow incoming connections for SQL Server, MECM, and other services.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
This script opens specific ports in the Windows Firewall to allow incoming connections for SQL Server, MECM, and other services. | |
.DESCRIPTION | |
This script configures the Windows Firewall to allow incoming TCP connections on ports used by SQL Server and other services. | |
This includes ports for SQL Server default instance, Dedicated Admin Connection, Service Broker, T-SQL Debugger/RPC, SSAS Default Instance, SQL Server Browser Service, HTTP, SSL, and a port for the 'Browse' button of SQL Server Browser Service. | |
It also allows incoming ICMPv4 echo requests (ping). | |
This script requires administrative privileges to run. | |
#> | |
Write-Host "========= SQL Server Ports ===================" | |
Write-Host "Enabling SQLServer default instance port 1433" | |
netsh advfirewall firewall add rule name="SQL Server" dir=in action=allow protocol=TCP localport=1433 | |
Write-Host "Enabling Dedicated Admin Connection port 1434" | |
netsh advfirewall firewall add rule name="SQL Admin Connection" dir=in action=allow protocol=TCP localport=1434 | |
Write-Host "Enabling conventional SQL Server Service Broker port 4022" | |
netsh advfirewall firewall add rule name="SQL Service Broker" dir=in action=allow protocol=TCP localport=4022 | |
Write-Host "Enabling Transact-SQL Debugger/RPC port 135" | |
netsh advfirewall firewall add rule name="SQL Debugger/RPC" dir=in action=allow protocol=TCP localport=135 | |
Write-Host "========= Analysis Services Ports ==============" | |
Write-Host "Enabling SSAS Default Instance port 2383" | |
netsh advfirewall firewall add rule name="Analysis Services" dir=in action=allow protocol=TCP localport=2383 | |
Write-Host "Enabling SQL Server Browser Service port 2382" | |
netsh advfirewall firewall add rule name="SQL Browser" dir=in action=allow protocol=TCP localport=2382 | |
Write-Host "========= Misc Applications ==============" | |
Write-Host "Enabling HTTP port 80" | |
netsh advfirewall firewall add rule name="HTTP" dir=in action=allow protocol=TCP localport=80 | |
Write-Host "Enabling SSL port 443" | |
netsh advfirewall firewall add rule name="SSL" dir=in action=allow protocol=TCP localport=443 | |
Write-Host "Enabling port for SQL Server Browser Service's 'Browse' Button" | |
netsh advfirewall firewall add rule name="SQL Browser" dir=in action=allow protocol=TCP localport=1434 | |
Write-Host "Allowing Ping command" | |
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment