Windows Firewall

Check

Get-NetFirewallProfile

Disable

Set-NetFirewallProfile -Enabled False

Enable

Set-NetFirewallProfile -Enabled True

Create Rule

To create a firewall rule to allow SQL Server access on the default port...

New-NetFirewallRule -Name "SQL Inbound" -Description "SQL Inbound" -DisplayName "SQL Inbound" -Enabled True -Profile Domain,Public,Private -Direction Inbound -Action Allow -Protocol TCP -LocalPort 1433

-Action - NotConfigured, Allow, Block-Direction - Inbound, Outbound-Enabled - True, False-Profile - Any, Domain, Private, Public, NotApplicable-Protocol - TCP, UDP, ICMPv4, ICMPv6

Bibliography