http://www.sqlservercentral.com/blogs/rocks/2012/05/10/command-line-to-configure-windows-firewall-for-sql-server-access/

Printed 2014/09/17 09:47PM

Command line to configure windows firewall for SQL server access

2012/05/10

I regularly deploy SQL Server to new Windows Server 2008 hosts and one thing that I find quite a chore is the wizard to configure the windows firewall on the host. So I done a quick bit of research today and found that the windows firewall can be configured from the command line very easily. Basically all you need to do is run the command prompt as an administrator and type/paste in the following:

netsh advfirewall firewall add rule name="SQL Server TCP1433-In" action=allow protocol=TCP dir=in localport=1433

Just change the name of the rule if you want and substitute the localport number if required to match the port that your SQL instance is listening on.

If you also want to allow access to the SQL Browser Service, then you can also easily open up the necessary UDP port 1434 that is required as well from the following

netsh advfirewall firewall add rule name="SQL Server UDP1434-In" action=allow protocol=UDP dir=in localport=1434
Enjoy!

Copyright © 2002-2014 Simple Talk Publishing. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.