Quickly Turn ON/OFF Windows Firewall Using Command Line

Windows Firewall on computers running Windows Vista, Windows 7 and Windows Server 2008 is enabled by default. You may need turn it off for various reasons.

This is how you do it using a command prompt:

  • To Turn Off:
  • NetSh Advfirewall set allprofiles state off
  • To Turn On:
  • NetSh Advfirewall set allprofiles state on
  • To check the status of Windows Firewall:
  • Netsh Advfirewall show allprofiles

 

About The Author

6 thoughts on “Quickly Turn ON/OFF Windows Firewall Using Command Line”

  1. Irina Ponarovskaya

    syntax error in item 4: allrprofiles instead of allprofiles…google picked that up…

    1.To Turn Off:
    2.NetSh Advfirewall set allprofiles state off.
    3.To Turn On:
    4.NetSh Advfirewall set allrprofiles state on.
    5.To check the status of Windows Firewall:
    6.Netsh Advfirewall show allprofiles.

  2. Nirmal,
    When I run this command on an SBS 2008 Server I am told that the firewall service is not running. What is odd is that I have outbound traffic on the server but nothing can connect inbound after installing ESET File Security for Windows Server v6. When I try turning the FW on I am met with a message that says error 5 and I can’t find anything that is helpful at this time. Any suggestions are appreciated.
    John – MCITP-EA

    1. It’s many years later but I used these commands the other day so.
      ESET and other AV’s can take control of the windows firewall and hosts files ,etc.

      It’s not unusual for outbound traffic to be allowed but certain inbound traffic blocked ,etc. You may even have a hardware firewall, firewall on your router or no NAT, port forwarding configured ,etc.

  3. Hello Nirmal Sir,

    I am currently a student and facing challenges with regards to creating a failover cluster in HYPER-V and need your expert guidance. Is there a way I can personally contact you with regards to the issue? Please suggest me. Appreciate it in advance. Regards Ran

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top