Advertisement
easternnl

Configure SQL Server Firewall with PowerShell

Dec 11th, 2015
585
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Configure SQL server to allow connections from the domain network.
  2.  
  3.  
  4. #Enabling SQL Server Ports
  5. New-NetFirewallRule -DisplayName “SQL Server” -Direction Inbound –Protocol TCP –LocalPort 1433 -Action allow -Profile Domain
  6. New-NetFirewallRule -DisplayName “SQL Admin Connection” -Direction Inbound –Protocol TCP –LocalPort 1434 -Action allow -Profile Domain
  7. New-NetFirewallRule -DisplayName “SQL Database Management” -Direction Inbound –Protocol UDP –LocalPort 1434 -Action allow -Profile Domain
  8. New-NetFirewallRule -DisplayName “SQL Service Broker” -Direction Inbound –Protocol TCP –LocalPort 4022 -Action allow -Profile Domain
  9. New-NetFirewallRule -DisplayName “SQL Debugger/RPC” -Direction Inbound –Protocol TCP –LocalPort 135 -Action allow -Profile Domain
  10. #Enabling SQL Analysis Ports
  11. New-NetFirewallRule -DisplayName “SQL Analysis Services” -Direction Inbound –Protocol TCP –LocalPort 2383 -Action allow -Profile Domain
  12. New-NetFirewallRule -DisplayName “SQL Browser” -Direction Inbound –Protocol TCP –LocalPort 2382 -Action allow -Profile Domain
  13. #Enabling Misc. Applications
  14. New-NetFirewallRule -DisplayName “HTTP” -Direction Inbound –Protocol TCP –LocalPort 80 -Action allow -Profile Domain
  15. New-NetFirewallRule -DisplayName “SSL” -Direction Inbound –Protocol TCP –LocalPort 443 -Action allow -Profile Domain
  16. New-NetFirewallRule -DisplayName “SQL Server Browse Button Service” -Direction Inbound –Protocol UDP –LocalPort 1433 -Action allow -Profile Domain
  17. #Enable Windows Firewall
  18. Set-NetFirewallProfile -DefaultInboundAction Block -DefaultOutboundAction Allow -NotifyOnListen True -AllowUnicastResponseToMulticast True -Profile Domain
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement