Audit Firewall Rules With Get-NetFirewallRule

List enabled rules and pipe them for review or export.

WindowsnetworkadminsecuritypowershellfirewallLow risk
Run Get-NetFirewallRule -Enabled True to list the enabled rules as objects.

01Command

Command
$ Get-NetFirewallRule -Enabled True | Select-Object DisplayName, Direction, Action

02What it does

The cmdlet returns every rule with direction, action, profile and ports, so you can filter for inbound allow rules or export an audit report. Reviewing a hundred rules in the GUI is tedious; piping them to Where-Object and Export-Csv is not.

03Risk

RiskLow risk
RequirementsWindows 10/11 with PowerShell 5.1 or PowerShell 7+
!Warning: Do not disable firewall rules ad hoc on a production host; understand the impact on remote management before changing them.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • Get-NetFirewallRule
    Microsoft Learn · vendor-doc · 2026-09-20
    Evidence: Retrieves firewall rules and their properties.

Last verified: 2026-10-13 · Category: Security & Privacy

06Related solutions