PowerShell: Check Windows Firewall Status
Need to check whether Windows Firewall is enabled - across the different network profiles (Domain, Private, Public)? This one-liner pulls the status straight from the system.
Prerequisites:
- Privileges: None
- Module: Built-in, no import needed
Quick Command:
Get-NetFirewallProfile | Select-Object Name, Enabled, DefaultInboundAction, DefaultOutboundAction
Example Output:
Name Enabled DefaultInboundAction DefaultOutboundAction
---- ------- -------------------- ---------------------
Domain True NotConfigured NotConfigured
Private True NotConfigured NotConfigured
Public True NotConfigured NotConfigured
📦
Want all of them at once?
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
How It Works:
- Get-NetFirewallProfile returns the status for each of Windows' three firewall profiles - Domain (when connected to a corporate domain network), Private (trusted home/work networks), and Public (untrusted networks like coffee shops).
- Enabled shows whether the firewall is actively turned on for that specific profile - each profile can be enabled/disabled independently.
- DefaultInboundAction/DefaultOutboundAction show what happens to traffic that doesn't match any specific rule - NotConfigured typically falls back to the system default (block inbound, allow outbound), while explicit Block/Allow values override that default.