Enable NetFirewallRule - PowerShell


The Enable-NetFirewallRule cmdlet enables a specified Windows Firewall rule. Once enabled, the rule becomes active and starts enforcing the defined firewall settings. This cmdlet is commonly used in both standalone and automated scenarios to manage firewall rules on Windows-based systems, enhancing network security.


Enable-NetFirewallRule [-Name] <string> [-Confirm] [-Force] [-WhatIf] [<CommonParameters>]


| Option/Flag | Description | Default Value |
| -Name | Specifies the name of the rule you want to enable. | |
| -Confirm | Prompts for confirmation before executing the command. | False |
| -Force | Suppresses the confirmation prompt and forces the command to execute. | False |
| -WhatIf | Simulates the command without actually making any changes to the firewall. | False |


Example 1: Enable a single rule by name

Enable-NetFirewallRule -Name "Allow-Web-Server"

Example 2: Enable multiple rules using a wildcard

Enable-NetFirewallRule -Name "Allow-Web-*"

Common Issues

  • Firewall service not running: Ensure that the Windows Firewall service is running before attempting to use Enable-NetFirewallRule. Use Get-Service -Name "Windows Firewall" to check its status.
  • Rule not found: Verify that the specified rule name exists in the firewall configuration. Use Get-NetFirewallRule -Name <name> to check.


Chain Enable-NetFirewallRule with other commands to create automated firewall management scripts. For instance, you can use Get-NetFirewallRule to retrieve a list of rules and then use Enable-NetFirewallRule to enable specific rules based on conditions.

  • Add-NetFirewallRule
  • Disable-NetFirewallRule
  • Get-NetFirewallRule
  • Set-NetFirewallRule