How to Turn Off/On Windows Firewall Using Command Prompt


👤 Diwas Poudel    🕒 07 Aug 2024    📁 TECH

In this article, I will show you how to enable Windows Firewall using Command Prompt. Using Command Prompt can be helpful, as you can run multiple commands quickly and easily.

Sometimes, you may need to fix network connectivity issues. In such cases, if you suspect that the firewall might be blocking traffic on domain, private, public, or any network, you can temporarily disable the firewall using the following command.

Note that there are 3 network in firewall that is 

Domain Network:  This network is used when the computer is connected to a network with an Active Directory domain.

Private Network: This network is used when the computer is connected to like home network.

Public Network: This network is used when the computer is connected to public network like airport wifi, restuarant wifi etc.

    fig. Showing private , public and domain network

I will show for each of them.

1. Disable Firewall for all Profile

Open Command Prompt as administrator and then type below command

netsh advfirewall set domainprofile state off

This will disable all firewall on your system

2. Enable Firewall for all Profile

After running the above command, you should test network connectivity to see if the issue related to the firewall blocking is resolved. If it is resolved, you can enable the firewall again.

Note: It is best practice to enable the network firewall back to maintain the security of your system.

For this open command prompt as administrator and then type below command:

netsh advfirewall set allprofiles state on

3. Disable Domain Network Profile 

For this open command prompt as administrator and then type below command:

netsh advfirewall set domainprofile state off

4. Enable Domain Network Profile 

For this open command prompt as administrator and then type below command:

netsh advfirewall set domainprofile state on

5. Disable Private Network Profile 

For this open command prompt as administrator and then type below command:

netsh advfirewall set privateprofile state off

6. Enable Private Network Profile 

For this open command prompt as administrator and then type below command:

netsh advfirewall set privateprofile state on

7. Disable Public Network Profile 

For this open command prompt as administrator and then type below command:

netsh advfirewall set publicprofile state off

8. Enable Public Network Profile 

For this open command prompt as administrator and then type below command:

netsh advfirewall set publicprofile state on

9. Check all Network Profile

For this open command prompt as administrator and then type below command:

netsh advfirewall show allprofiles

In this way we can easily enable and disable network profile using command line.