How do I disable the Windows firewall?

How to disable the Windows firewall

Under Windows, the system's built-in firewall is used to filter incoming and outgoing connections. Although it's recommended to leave it active for security reasons, and to try to configure it instead, it can be useful to temporarily disable the Windows firewall.

This tutorial gives you several possible solutions, including command-line solutions via netsh and PowerShell. Before getting to the heart of the matter, I'd like to remind you of the notion of "network profile", because when you're connected to a network, a profile is applied:

  • Réseau privé, quand vous êtes à la maison par exemple
  • Réseau public, quand vous êtes connecté à un hotspot public style McDo ou parfois chez vous la machine peut se mettre en public
  • Réseau de domaine, quand vous êtes connecté à un environnement Active Directory (réseau de votre entreprise)

A Windows firewall rule can be activated on one profile, but not on another. All this to say that the firewall can be disabled on one profile, but enabled on another: you don't have to disable it entirely!

From the graphical user interface, the firewall can also be disabled from the Control Panel or Windows security (which you search for in the PC search box) as shown in the image below. Simply select a profile, then click on the " " button. Activated "to change the profile to " Off" .

Disable Windows Firewall from the command line

1. Disable Windows firewall with netsh

Firstly, you can disable the Windows firewall with the netsh command, which has been available on Windows for a very, very long time! This tool has a complete command set for managing the Windows firewall: netsh advfirewall.

Here are a few examples, depending on your needs:

  • Désactiver entièrement le pare-feu Windows (tous les profils)
netsh advfirewall set allprofiles state off
  • Désactiver le pare-feu Windows sur le profil privé
netsh advfirewall set privateprofile state off 
  • Désactiver le pare-feu Windows sur le profil public
netsh advfirewall set publicprofile state off
  • Désactiver le pare-feu Windows sur le profil domaine Active Directory
netsh advfirewall set domainprofile state off 
  • Désactiver le pare-feu Windows sur le profil en cours d’utilisation

If you don't know which profile is currently in use and want to disable the firewall, run this command:

netsh advfirewall set currentprofile state off 
  • Activer le pare-feu Windows

Of course, you can reactivate it at any time by using "state on" instead of "state off". For example:

netsh advfirewall set allprofiles state on

However, you can also check which profile your machine is currently using t with this command:

netsh advfirewall show currentprofile

2. Disabling the Windows firewall with PowerShell

Let's see how to do the same thing with PowerShell, since the PowerShell console is more fashionable than netsh, although both are capable of doing the job... With PowerShell, we'll rely on the command Set-NetFirewallProfile.

  • Désactiver le pare-feu sur tous les profils
Set-NetFirewallProfile -All -Enabled False
  • Désactiver le pare-feu sur le profil privé, public ou domaine

In this first example, we disable the Windows firewall on the "Domain" profile:

Set-NetFirewallProfile -Profile Domain -Enabled False

But you can specify several profiles at once, as in the example below with the Domain and Private profiles:

Set-NetFirewallProfile -Profile Domain,Private -Enabled False
  • Activer le pare-feu avec PowerShell

Here, too, we can do the opposite, i.e. activate the firewall using the -Enable parameter. Simply set it to True. Here's how to re-enable the firewall on the Public profile:

Set-NetFirewallProfile -Profile Public -Enabled True

3. Conclusion

With this article from the tutorial box, you will be able to disable (and re-enable) the Windows firewall from the command line. It's up to you to choose the command you prefer. Personally, I'd recommend PowerShell. Alternatively, you can use GPOs to manage the Windows firewall and create bulk rules for your company's machines.

Resources :

You may also like...

Leave a Reply

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