Modify

Enable/Disable Firewall

netsh firewall reset

Completely removes/resets firewall settings.

netsh firewall set opmode enable

Enables Windows Firewall.

netsh firewall set opmode disable

Disables Windows Firewall.

netsh advfirewall set allprofiles state off

Toggles firewall off for all profiles.

netsh advfirewall set currentprofile state off

Toggles firewall off for the current profile.

Set-NetFirewallProfile -Profile Domain -Enabled True

Toggles firewall for the specified profile (can toggle all at once: Domain, Private, Public).

netsh advfirewall set privateprofile state on

Toggles firewall on for the specified profile.

Logging

Log dropped connections on all profiles:

netsh advfirewall set allprofiles logging droppedconnections enable

Log dropped packets and connections:

netsh firewall set logging droppedpackets=enable connections=enable

Set current profile log's max size:

netsh advfirewall set currentprofile logging maxfilesize 1024

Add Rules

Delete Rules

Removes a firewall rule:

Removes a firewall rule by name:

Deletes an existing inbound or outbound firewall rule:

Deletes a rule by name:

Deletes a rule by name:

Modify Existing Rules

Modifies existing firewall rules:

Enable All ICMP Traffic:

Allow inbound echo request:

Disable groups of rules:

Enable groups of rules:

Export/Import Rules

Create a BACKUP of the netsh firewall configuration:

Restore netsh firewall configuration from BACKUP:

Registry Locations

Globally Open Ports:

Authorized Apps:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy

Holds settings for Windows Firewall policies, including rules and profiles for Domain, Private, and Public networks.

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall

Contains Windows Firewall configuration settings applied through Group Policy for Domain, Private, and Public profiles.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\WindowsFirewall

Used by older versions of Windows to store Windows Firewall settings that are applied across different profiles.

HKEY_CURRENT_USER\Software\Policies\Microsoft\WindowsFirewall

Stores user-specific Windows Firewall settings applied through Group Policy, affecting the firewall behavior for the current user.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Defaults\FirewallPolicy

Default configuration settings for Windows Firewall, including default rules and policy settings for all profiles.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles

Contains information on network profiles, which can influence Windows Firewall behavior based on the network's classification (Private, Public, Domain).

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsFirewall\AdvancedSecurity

Stores advanced settings for Windows Firewall with Advanced Security, including inbound and outbound rules, and connection security rules.

Last updated

Was this helpful?