Skip to main content

Windows Command Line Firewall Commands

To Turn Off:

    NetSh Advfirewall set allprofiles state off
    NetSh Advfirewall set domainprofile state off

To Turn On:

    NetSh Advfirewall set allprofiles state on
    NetSh Advfirewall set domainprofile state on

To check the status of Windows Firewall:

    Netsh Advfirewall show allprofiles

Show firewall status

    NetSh Advfirewall show allprofiles

Turn on File Sharing Firewall Rule

netsh Advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes

Turn On Admin Share

    REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

Open Firewall for application

    netsh advfirewall firewall add rule name="Solstice Client" dir=in action=allow program="C:\program files (x86)\solsticeclient\solsticeclient.exe"

Open Firewall for Port

    netsh advfirewall firewall add rule name="TCP Port 1433" dir=in action=allow protocol=TCP localport=1433

Remove a Firewall Rule

    netsh advfirewall firewall delete rule name="TCP Port 6624" protocol=TCP localport=6624
    netsh advfirewall firewall delete rule name="TCP Port 6624"