This section is aimed at using the command line interface for configuring the Windows Firwall netsh firewal
netsh firewall add allowedprogram C:\Program Files (x86)\Git\bin\git.exe "Git Allow" ENABLE
This section is aimed at using the command line interface for configuring the Windows Advanced Firwall netsh advfirewall
in 2008 R2 and 2012 flavors of Windows Server as well as Windows 8.x variants.
Allow incoming connections to port 80
netsh advfirewall firewall add rule name="Open Port 80" dir=in action=allow protocol=TCP localport=80
Allow a program through the firewall:
PS C:\> netsh advfirewall firewall add rule name="Git Allow" dir=in action=allow program="C:\Program Files (x86)\Git\bin\git.exe" enable=yes
Ok.
Now if we need to delete the rule we just created we can do so with the following command:
PS C:\> netsh advfirewall firewall delete rule name="Git Allow" program="C:\Program Files (x86)\Git\bin\git.exe"
Deleted 1 rule(s).
Ok.
Allow ICMP for IPv4
PS C:\> netsh advfirewall firewall add rule name="ICMP Allow" protocol=icmpv4 dir=in action=allow
Ok.
Deny ICMP for IPv4
PS C:\> netsh advfirewall firewall add rule name="ICMP Allow" protocol=icmpv4 dir=in action=block
Ok.