Disable/Enable Windows 10 Firewall via command prompt

Although it is advised that the Windows 10 firewall always be active, there are times when turning it off is necessary, such as if you need to test an app connection or if you wish to utilise a different firewall solution.

Disable Windows 10 Firewall

To turn off (disable) the Windows 10 firewall via command prompt, follow the steps below:

  1. Go to the Search menu, type cmd and launch the command prompt by clicking on Run as Administrator
  2. In the command-prompt window, type netsh advfirewall set allprofiles state off, and press Enter to disable all firewall profiles. For example:
    Microsoft Windows [Version 10.0.19044.2130]
    (c) Microsoft Corporation. All rights reserved.
    
    C:\WINDOWS\system32> netsh advfirewall set allprofiles state off
    ok.
    
    The above example disables all firewall profiles. If you want to disable a specific firewall profile, substitute allprofiles with one of the following:
    • domainprofile - Domain network firewall
    • privateprofile - Private network firewall
    • publicprofile - Public network firewall
  3. Type exit in the command prompt window to close it.

Enable Windows 10 Firewall

To turn on (enable) the Windows 10 firewall via command prompt, follow the steps below:

  1. Go to the Search menu, type cmd and launch the command prompt by clicking on Run as Administrator
  2. In the command-prompt window, type netsh advfirewall set allprofiles state on, and press Enter to disable all firewall profiles. For example:
    Microsoft Windows [Version 10.0.19044.2130]
    (c) Microsoft Corporation. All rights reserved.
    
    C:\WINDOWS\system32> netsh advfirewall set allprofiles state on
    ok.
    
    The above example enables all firewall profiles. If you want to enable a specific firewall profile, substitute allprofiles with one of the following:
    • domainprofile - Domain network firewall
    • privateprofile - Private network firewall
    • publicprofile - Public network firewall
  3. Type exit in the command prompt window to close it.

What are Windows firewall profiles?

Windows Firewall offers three network profiles: domain, private and public. The network profiles are used to assign rules. For example, you can allow a specific application to communicate on a private network, but not on a public network.

Domain network

The domain network profile is automatically applied to a device that is joined to an Active Directory domain, when it detects the availability of a domain controller. This network profile cannot be set manually.

Private network

The private network profile is designed for private networks such as a home network. It can be set manually on a network interface by an administrator.

Public network

The public network profile is designed with higher security in mind for public networks, like Wi-Fi hotspots, coffee shops, airports, hotels, etc. It's the default profile for unidentified networks.