How to Create Sql Server 2016 Firewall Rules using Gui En PowerShell.
With GUI:
- Start the system and loggen in (with admin rights user);
2. Open Control Panel. Klikken op Windows Firewall;
3. After that click on Advanced Settings;
4. Windows Firewall console open. If you click on Eigenschappen (right side) – you can disable firewalls for all networks. We going to Inbound Rules (left side) for our rule creation;
5. Klikken op New Rule;
6. Rule creation process begins. In mijn geval, I create a rule for Inbound TCP ports. Voor Rule Type select option Port en klik Volgende;
7. Voor Protocol and Ports select option TCP En Special Local Ports. I use 2 ports for SCCM deployment (8080, 14331) and also added standard Sql TCP ports (1433,1434,4022). After entering ports click Volgende;
8. Voor Action (in this case leave by default Allow the connection). Klik Volgende;
9. Voor Profile, leave by default, klik Volgende;
10. Enter a name for your rule (for example Sql TCP Ports), so you can easily find it in the future. Klik Finish;
11. In the last screenshot, you see two rules, which I created for Sql Server. One for TCP ports and one for UPD port (1434).
With PowerShell:
- Loop PowerShell als beheerder;
2. Enter text and press Enter:
New-NetFirewallRule -DisplayName "SQL TCP Ports" -Direction Inbound –Protocol TCP –LocalPort 8080, 1433, 1434, 4022, 14331 -Action allow
Some explanations:
-DisplayName “SQL TCP Ports” – Rule Name;
-Direction Inbound – Rule direction;
–Protocol TCP – Protocol (TCP or UDP);
–LocalPort – Your ports;
-Action allow – Allow or Disallow.