Windows Firewall rules that come from Group Policy are not exposed directly through GetGPOList or similar Win32 GPO-enumeration APIs. GetGPOList only tells which GPOs apply; it does not parse their Windows Firewall policy data.
To programmatically read the effective firewall configuration (including rules coming from domain GPOs) in a corporate domain, query the local policy store on a domain-joined machine using the Windows Firewall / IPsec management APIs or PowerShell cmdlets, rather than trying to read GPOs directly:
- Use the Windows Firewall with Advanced Security policy store
- The effective rules on a client are the result of merging:
- Domain GPOs
- MDM/CSP policy (if present)
- Local Group Policy
- Local rules (if
AllowLocalPolicyMergeis enabled for that profile)
- These are all surfaced through the Windows Firewall policy store on the machine. The same store is used by the MMC snap-in (
wf.msc) and by the PowerShell cmdlets.
- The effective rules on a client are the result of merging:
- Enumerate rules via PowerShell (for reference / reverse‑engineering)
- On a domain-joined client where the GPOs are applied, run:
This shows IPsec rules in the active policy store, including those from GPOs.Show-NetIPsecRule -PolicyStore ActiveStore - To inspect a specific rule and see where it came from:
This returnsGet-NetIPsecRule -DisplayName "Require Inbound Authentication" -TracePolicyStorePolicyStoreSourceType = GroupPolicyand aPolicyStoreSourcethat identifies the GPO. - Similar cmdlets exist for classic firewall rules (
Get-NetFirewallRule,Show-NetFirewallRule) and use the same policy store model.
- On a domain-joined client where the GPOs are applied, run:
- Programmatic approach (Win32 / COM)
- Instead of
GetGPOList, use the Windows Firewall with Advanced Security COM interfaces (or the newer Net* APIs) that operate on the local policy store. These APIs read the merged policy that already includes domain GPO settings. - Conceptually, this is equivalent to what the MMC snap-in does when it displays rules under Windows Firewall with Advanced Security on a domain-joined machine.
- Instead of
- Be aware of rule merging behavior
- In high-security environments, administrators can disable local rule merging via the
AllowLocalPolicyMergesettings for Domain/Private/Public profiles (through CSP or GPO). When disabled, only centrally deployed rules (GPO/MDM) are effective. - Local Group Policy firewall rules are still applied even when merge from other local sources is disabled.
- When reading from the active policy store, the result already reflects these merge rules; no need to manually interpret GPOs.
- In high-security environments, administrators can disable local rule merging via the
- If the goal is to know which GPO defined a rule
- Use the policy-store tracing behavior (as shown with
-TracePolicyStore) as a model: query the rule from the active store, then inspect its policy store metadata to identify the source GPO. - This avoids having to parse GPOs and their registry/policy files directly.
- Use the policy-store tracing behavior (as shown with
In summary, the correct rabbit hole is the Windows Firewall policy store (via firewall/IPsec APIs or the Net* cmdlets), not GetGPOList. GetGPOList is useful only to know which GPOs apply, not to read firewall rules themselves.
References: