Pcornel
Windows

Windows Firewall

Cheat sheet · https://pcornel.dk/topic.php?topic=3098

Back to the Topic

Answer

Windows Defender Firewall is the built-in host firewall. It filters inbound and outbound traffic with rules per profile (Domain, Private, Public) and is managed via wf.msc, netsh advfirewall, PowerShell or GPO.

Remember

  • The default inbound action is block; outbound is allow.
  • The active profile (Domain, Private, Public) decides which rules apply.
  • GPO firewall rules merge with or override local rules.

First checks

  • Get-NetFirewallProfile — profiles, enabled, default actions, logging
  • Get-NetFirewallRule -Enabled True -Direction Inbound — enabled inbound rules
  • Get-NetFirewallRule -DisplayName '<name>' | Get-NetFirewallPortFilter — ports of a rule
  • netsh advfirewall monitor show firewall — effective state

Commands

netsh advfirewall
Configure Windows Firewall from the command line.
New-NetFirewallRule
Create a Windows Firewall rule.
Get-NetFirewallRule
Firewall rules and policy metadata.
Get-NetFirewallRule [-DisplayName <pattern>]
Display Windows Firewall rules.
Get-NetFirewallRule | Where-Object Enabled -eq True
Shows enabled Windows Defender Firewall rules.

Verify in this order

active profile → rules → default action → packet allowed/blocked

Where it usually breaks

First mismatch in host/interface identity → local config/routing/name state → Windows service/provider → firewall/security/session → remote service → application-visible exchange; preserve identity/native error/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3098

Confirmation

Confirm action

Continue?