Use this when Windows Firewall blocks or allows unexpected traffic.
Firewall Troubleshooting
Troubleshoot Windows Firewall by checking the active profile, testing with Test-NetConnection, reviewing rules with Get-NetFirewallRule, enabling firewall logging (pfirewall.log) and checking GPO-applied rules.
1. Service listening? Get-NetTCPConnection -State Listen -LocalPort <p>.
2. Active profile and matching rule?
3. Enable logging: pfirewall.log DROP entries.
4. Event 5152/5157 with WFP auditing.
5. Third-party firewall/AV?
listener → profile → rule match → WFP → allowed
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Known-good, broken and when it is fixed Verify boundary
Known-good means the intended profile is active, a least-privilege effective rule permits the exact required flow, the listener is present and the original remote/local connection succeeds while unrelated traffic remains constrained. Broken evidence is wrong profile, blocked tuple, policy-owned override or allow rule with no listener. The limit of what it shows is the exact service flow under enabled firewall policy; a GUI rule entry alone is not evidence of enforcement outcome.
Step 2 Common mistakes Narrow the fault
- Disabling the firewall to test.
Step 3 Native failure isolation and next-check logic Narrow the fault
For a blocked flow, capture local/remote address, protocol/port, direction, application/service and active network profile. Verify the listener separately, then inspect effective firewall rules and policy source for that tuple. If disabling the firewall changes behavior, restore it immediately and identify the precise missing/conflicting rule rather than leaving a broad exception. If the rule is correct, move to routing, IPsec or remote-side policy instead of adding duplicates.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Check which profile is active.
- GPO rules may override local ones.
- Logs show dropped packets.
Get-NetFirewallProfile— profiles, enabled, default actions, loggingGet-NetFirewallRule -Enabled True -Direction Inbound— enabled inbound rulesGet-NetFirewallRule -DisplayName '<name>' | Get-NetFirewallPortFilter— ports of a rulenetsh advfirewall monitor show firewall— effective state
ReferenceHow it works1 section · depth on demand
How it works
Windows Defender Firewall evaluates profile, direction, protocol/port, program/service, address scope and rule precedence/effective policy. Domain/Private/Public profile selection can change effective rules without any application change, and Group Policy/MDM may own rules that local edits cannot durably override. A listening socket does not show the firewall allows it, while a firewall allow rule does not show the application is listening.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Turn on logging for dropped packets
PS C:\> Set-NetFirewallProfile -Profile Domain,Private,Public -LogBlocked True -LogAllowed False -LogMaxSizeKilobytes 16384 -LogFileName '%systemroot%\system32\LogFiles\Firewall\pfirewall.log'
PS C:\> Get-Content C:\Windows\System32\LogFiles\Firewall\pfirewall.log -Tail 20 | Select-String '443|3389'
2026-11-27 10:14:22 DROP TCP 10.0.10.55 10.0.10.21 52811 3389 52 S 1204 0 64240 - - - RECEIVE
Microsoft documents configuring firewall logging for dropped packets and successful connections via Group Policy or Intune; with GPO-managed firewalls, set logging in the policy too, or the local setting is overridden.
Which rule decided?
Firewall rules merge from local configuration, GPO and MDM. Check what is effective:
Get-NetFirewallRule -PolicyStore ActiveStore -Enabled True -Direction Inbound |
Where { $_.DisplayName -match 'Remote Desktop' } | Get-NetFirewallPortFilter
Get-NetFirewallProfile | Select Name, Enabled, DefaultInboundAction, AllowLocalFirewallRules
AllowLocalFirewallRules False (from GPO) ignores locally added rules — the usual reason a new local rule "does nothing".
Deeper: WFP audit
auditpol /set /subcategory:"Filtering Platform Packet Drop" /failure:enable
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=5152} -MaxEvents 20
netsh wfp show filters file=C:\Temp\filters.xml
Event 5152 contains the filter ID that dropped the packet; look it up in the netsh wfp show filters output to find the exact rule or third-party filter (VPN or security software also use WFP).
Checklist
| Step | Question |
|---|---|
| 1 | Which profile is the interface in? (Get-NetConnectionProfile) |
| 2 | Is the service listening? (Get-NetTCPConnection -State Listen) |
| 3 | Is a matching allow rule enabled for that profile and program/port? |
| 4 | Does a block rule match first? (block wins over allow) |
| 5 | Is another WFP-based product filtering? (5152 filter ID) |
Disable logging of allowed packets again after troubleshooting — it grows quickly.
*The firewall DROP record is a constructed illustration of a blocked RDP packet, not an observed traffic event.*
Method
Firewall troubleshooting:
1. Confirm the service listens: Get-NetTCPConnection -State Listen -LocalPort 8443.
2. Test from the client: Test-NetConnection srv01 -Port 8443.
3. Check active profile per interface: Get-NetConnectionProfile.
4. Find the effective rule: Get-NetFirewallRule -PolicyStore ActiveStore | ? Enabled | Get-NetFirewallPortFilter | ? LocalPort -eq 8443.
5. Look for blocks: firewall log (%SystemRoot%\System32\LogFiles\Firewall\pfirewall.log) or events 5152/5157.
6. Remember third-party WFP filters (EDR, VPN) can block independently.
Get-NetFirewallRule -PolicyStore ActiveStore | Measure-Object
Get-NetFirewallSetting -PolicyStore ActiveStore
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Windows Firewall → Firewall Troubleshooting. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/windows/security/operating-system-security/network-security/windows-firewall/ · confidence 94%