Wednesday, October 4, 2023

SQL Windows Firewall

I set up a lot of SQL servers. Here are the powershell commands to allow the sql ports. Please don't be 'that guy' who shuts off the firewall.

New-NetFirewallRule -DisplayName "SQLServer default instance" -Direction Inbound -LocalPort 1433 -Protocol TCP -Action Allow

New-NetFirewallRule -DisplayName "SQLServer Browser service" -Direction Inbound -LocalPort 1434 -Protocol UDP -Action Allow


You can also do it with netsh in DOS.

netsh advfirewall firewall add rule name = SQLPort dir = in protocol = tcp action = allow localport = 1433 remoteip = localsubnet profile = DOMAIN


netsh firewall set portopening protocol = TCP port = 1433 name = SQLPort mode = ENABLE scope = SUBNET profile = CURRENT

No comments:

Post a Comment