首页 > 服务器 > Web服务器 > 正文

打开SQL Server防火墙端口的批处理

2024-09-01 13:43:06
字体:
来源:转载
供稿:网友
服务器上安装了SQL Server 2012,但Windows防火墙屏蔽了远程访问。在不关闭防火墙的情况下,需要手工打开所有SQL Server所使用的端口。微软网站上发现个批处理,可以帮我们完成这个很蛋疼的重复劳动。

要打开的端口有1433、1434、4022、135、2383、2382、80、443、1434


@echo =========  SQL Server Ports  ===================
@echo Enabling SQLServer default instance port 1433
netsh firewall set portopening TCP 1433 "SQLServer"
@echo Enabling Dedicated Admin Connection port 1434
netsh firewall set portopening TCP 1434 "SQL Admin Connection"
@echo Enabling conventional SQL Server Service Broker port 4022
netsh firewall set portopening TCP 4022 "SQL Service Broker"
@echo Enabling Transact-SQL Debugger/RPC port 135
netsh firewall set portopening TCP 135 "SQL Debugger/RPC"
@echo =========  Analysis Services Ports  ==============
@echo Enabling SSAS Default Instance port 2383
netsh firewall set portopening TCP 2383 "Analysis Services"
@echo Enabling SQL Server Browser Service port 2382
netsh firewall set portopening TCP 2382 "SQL Browser"
@echo =========  Misc Applications  ==============
@echo Enabling HTTP port 80
netsh firewall set portopening TCP 80 "HTTP"
@echo Enabling SSL port 443
netsh firewall set portopening TCP 443 "SSL"
@echo Enabling port for SQL Server Browser Service's 'Browse' Button
netsh firewall set portopening UDP 1434 "SQL Browser"
@echo Allowing multicast broadcast response on UDP (Browser Service Enumerations OK)
netsh firewall set multicastbroadcastresponse ENABLE 经测试,SQL Server 2012有效。(同样适用于2008)
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表