How to disable firewall on Windows Server (2023)

On Windows Server, you can disable (and enable) the default firewall in at least six ways, and here's how.

Windows Server disable firewall

You can disable the Microsoft Defender Firewall on a Windows Server, and in this guide, you will learn how. The Microsoft Defender Firewall is the firewall solution that comes built by default on every installation of Windows and Windows Server to monitor incoming and outgoing network traffic to allow or block connections based on rules to protect the device from unauthorized access.

It’s always recommended to keep the firewall running to prevent making the server vulnerable. However, in some situations, you may need to disable the security feature. For instance, when you have to troubleshoot network-related issues, plan to implement a third-party firewall, or you have to test a network application. 

If you must disable the firewall on Windows Server 2022, 2019, and older releases, you can complete this task from Windows Security, Control Panel, Command Prompt, PowerShell, Group Policy, and Registry.

In this guide, you will learn how to disable (re-enable) the built-in firewall on Windows Server.

Disable firewall on Windows Server from Windows Security

To disable the firewall on Windows Server, use these steps:

  1. Open Windows Security on Windows Server.

  2. Click on Firewall & network protection.

  3. Click the active network option.

    Windows Security active firewall

  4. Turn off the “Microsoft Defender Firewall” toggle switch to disable the firewall.

    Microsoft Defender Firewall disable option

    Quick tip: If you only want to prevent incoming connections, check the “Blocks all incoming connections, including those in the list of allowed apps” option instead of disabling the feature.

Once you complete the steps, the Microsoft Defender Firewall will disable the active network profile.

If you have to disable the firewall for every network profile, open each network profile (“Domain network,” “Private network,” and “Public network”) and turn off the “Microsoft Defender Firewall” toggle switch.

Enable firewall

To enable the firewall on Windows Server, use these steps:

  1. Open Windows Security on Windows Server.

  2. Click on Firewall & network protection.

  3. Click the “Turn on” button from the network profile. Or click the Restore settings button (if applicable).

    Windows Server enable firewall

After you complete the steps, the Microsoft Defender Firewall will enable again on the computer.

Disable firewall on Windows Server from Control Panel

To turn off the Windows Server firewall from Control Panel, use these steps:

  1. Open Control Panel.

  2. Click on System and Security.

  3. Click on Windows Defender Firewall.

    Windows Defender Firewall

  4. Click the “Turn Windows Defender Firewall on or off” option from the left navigation pane.

    Control Panel firewall settings

  5. Select the “Turn off Windows Defender Firewall” option under the “Private network settings” section.

  6. Select the “Turn off Windows Defender Firewall” option under the “Public network settings” section.

    Windows Server disable firewall from Control Panel

  7. Click the OK button.

Once you complete the steps, the security feature will stop protecting your server.

Enable firewall

To enable the firewall with Control Panel, use these steps:

  1. Open Control Panel.

  2. Click on System and Security.

  3. Click on Windows Defender Firewall.

    Windows Defender Firewall

  4. Click the “Turn Windows Defender Firewall on or off” option from the left pane.

    Control Panel firewall settings

  5. Select the “Turn on Windows Defender Firewall” option under the “Private network settings” section.

  6. Select the “Turn on Windows Defender Firewall” option under the “Public network settings” section.

    Windows Server enable firewall

  7. Click the OK button.

After you complete the steps, the Windows Server firewall will start monitoring and protecting the server from malicious connections.

Disable firewall on Windows Server from Command Prompt

To turn off the firewall from Command Prompt on Windows Server 2022, 2019, and old versions, use these steps:

  1. Open Start.

  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.

  3. Type the following command to disable the firewall for the active network profile and press Enter:

    netsh advfirewall set currentprofile state off

    Command Prompt disable firewall

  4. (Optional) Type the following command to turn off the firewall for every network profile, including domain, private, and public, and press Enter:

    netsh advfirewall set allprofiles state off
  5. (Optional) Type the following command to turn off the Microsoft Defender Firewall for the domain network profile on Windows Server and press Enter:

    netsh advfirewall set domainprofile state off
  6. (Optional) Type the following command to turn off the firewall for the private network profile and press Enter:

    netsh advfirewall set privateprofile state off
  7. (Optional) Type the following command to turn off the firewall for the public network profile and press Enter:

    netsh advfirewall set publicprofile state off

After you complete the steps, the Microsoft Defender Firewall will disable on Windows Server, according to your configuration.

Enable firewall

To turn on the Windows Server firewall from Command Prompt, use these steps:

  1. Open Start.

  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.

  3. Type the following command to turn on the Microsoft Defender Firewall for the current network profile and press Enter

    netsh advfirewall set currentprofile state on

    Command Prompt enable firewall

  4. (Optional) Type the following command to enable the Defender Firewall for all network profiles on Windows Server and press Enter:

    netsh advfirewall set allprofiles state on
  5. (Optional) Type the following command to enable the Windows Server firewall for the domain network profile and press Enter:

    netsh advfirewall set domainprofile state on
  6. (Optional) Type the following command to enable the firewall for the private network and press Enter:

    netsh advfirewall set privateprofile state on
  7. (Optional) Type the following command to turn on the firewall for the public network profile and press Enter:

    netsh advfirewall set publicprofile state on

Once you complete the steps, the Windows Server firewall will enable, according to your configuration.

Disable firewall on Windows Server from PowerShell

To disable the firewall on Windows Server from PowerShell, use these steps:

  1. Open Start.

  2. Search for PowerShell, right-click the top result, and select the Run as administrator option.

  3. Type the following command to disable the Microsoft Defender Firewall fall all networks and press Enter:

    Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False

    PowerShell disable firewall

    Quick tip: If you want to leave one or more networks protected with the firewall, then make sure to remove the profile name from the command.

After you complete the steps, the Windows Server firewall will disable on the server.

Enable firewall

To enable the firewall with PowerShell commands, use these steps:

  1. Open Start.

  2. Search for PowerShell, right-click the top result, and select the Run as administrator option.

  3. Type the following command to enable the Microsoft Defender Firewall for all networks and press Enter:

    Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True

    PowerShell enable firewall

Once you complete the steps, the PowerShell command will enable the firewall to allow and deny network access.

Disable firewall on Windows Server from Group Policy

To disable the Windows Server firewall through Group Policy, use these steps:

  1. Open Start.

  2. Search for gpedit.msc and click the top result to open the Local Group Policy Editor.

  3. Open the following path:

    Computer Configuration > Administrative Templates > Network > Network Connections > Windows Defender Firewall > Standard Profile
  4. Double-click to open the “Windows Defender Firewall: Protect all network connections” policy.

    Group Policy defender firewall policies

  5. Check the Disabled option.

    Defender firewall policy disabled

  6. Click the Apply button.

  7. Click the OK button.

  8. Restart the server.

After you complete the steps, the server will restart to apply the new settings to disable the firewall.

Enable firewall

To enable the Windows Server firewall through Group Policy, use these steps:

  1. Open Start.

  2. Search for gpedit.msc and click the top result to open the Local Group Policy Editor.

  3. Open the following path:

    Computer Configuration > Administrative Templates > Network > Network Connections > Windows Defender Firewall > Standard Profile
  4. Double-click to open the “Windows Defender Firewall: Protect all network connections” policy.

    Group Policy defender firewall policies

  5. Check the “Not configured” option.

    Defender firewall policy enabled

  6. Click the Apply button.

  7. Click the OK button.

  8. Restart the server.

After you complete the steps, the server will restart to enable the Microsoft Defender Firewall.

Disable firewall on Windows Server from Registry

To turn off the firewall using the Windows Server Registry, use these steps:

  1. Open Start.

  2. Search for regedit and click the top result to open the Registry.

  3. Open the following path:

    HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall
  4. Right-click the “WindowsFirewall” key, select the New menu, and choose the “Key” option.

    Registry StandardProfile key

  5. Name the key StandardProfile and press Enter.

  6. Right-click the “StandardProfile” key, select the New menu, and choose the “DWORD (32-bit) Value” option.

    Registry disable Windows Server firewall

  7. Name the EnableFirewall name and press Enter.

  8. Double-click the newly created key and set the value to “0”.

  9. Click the OK button.

  10. Restart the server.

Once you complete the steps, the Windows Server will restart to apply the settings.

Enable firewall

To enable the Windows Server firewall from the Registry, use these steps:

  1. Open Start.

  2. Search for regedit and click the top result to open the Registry.

  3. Open the following path:

    HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile
  4. Right-click the EnableFirewall key and choose the Delete option.

    Windows Server Registry enable firewall

  5. Click the OK button.

  6. Restart the server.

After you complete the steps, the Windows Server will enable the firewall.