Skip to content

Disable Windows Firewall with PowerShell

How to disable the Windows Firewall with PowerShell in Windows Server 2012/2016/2019? I don’t recommend turning off the Windows Firewall with PowerShell. But if you have a test lab and want to disable it for testing, go ahead. Don’t forget to enable the Firewall when you finish testing. In this article, you will learn how to disable Windows Firewall with PowerShell.

Windows Firewall profiles information

Windows Firewall offers three firewall profiles:

  • Domain profile: applies to networks where the host system can authenticate to a domain controller.
  • Private profile: a user-assigned profile and is used to designate private or home networks.
  • Public profile: this is the default profile. It is used to designate public networks such as Wi-Fi hotspots at coffee shops, airports, and other locations.

Get status of the Windows Firewall with PowerShell

First, let’s get the current status of the Windows Firewall. We will be using the Get-NetFirewallProfile cmdlet.

PS C:\> Get-NetFirewallProfile | Format-Table Name, Enabled

Name    Enabled
----    -------
Domain     True
Private    True
Public     True

We have three profiles: Domain, Name, and Public. Windows Firewall is enabled on all three profiles.

Disable Windows Firewall with PowerShell Windows Firewall is on

In the next step, we are going to disable the Windows Firewall.

Disable Windows Firewall in Windows Server 2012/2016/2019

Disable Windows Firewall on all three profiles.

PS C:\> Set-NetFirewallProfile -Profile Domain, Public, Private -Enabled False

Check Windows Firewall status

Check the status after you disable the Firewall on all three profiles. Run the Get-NetFirewallProfile cmdlet.

PS C:\> Get-NetFirewallProfile | Format-Table Name, Enabled

Name    Enabled
----    -------
Domain    False
Private   False
Public    False
Disable Windows Firewall with PowerShell Windows Firewall is off

Windows Firewall is disabled on all three profiles in Windows Server. Have fun testing. Don’t forget to enable the Windows Firewall after you have finished troubleshooting or testing. It’s important to keep the Windows Firewall turned on.

Conclusion

You learned how to disable the Firewall in Windows Server 2012/2016/2019/2022. First, get the current status of the Windows Firewall. After that, disable the Windows Firewall with PowerShell. As of last, verify that the Windows Firewall is disabled.

Did you enjoy this article? If so, you may like Windows Server post-installation configuration. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 2 Comments

Leave a Reply

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