PowerShell
public
Windows Firewall Profile
Share this script safely, inspect its metadata, and copy the exact command you need.
Ready to run
One-liner
curl -fsSL https://runny.sh/r/GHZDBZZK1TY9 | pwsh
Current version: 1.1 · Updated by Godmode · 2026-09-07 02:38:59.570
At a glance
Script metadata
Readable before runnable
Preview
# Windows firewall profile
# Read-only: Get-NetFirewallProfile. Warns if every profile is disabled.
# Exit 0 if at least one profile is on, 1 if all are off, 2 on error.
# Hosted on Runny.sh. Review the script page before you run it.
$ErrorActionPreference = 'Continue'
$status = 0
function Write-Line {
param([string]$Text)
Write-Output $Text
}
function Set-Warn {
if ($script:status -lt 1) { $script:status = 1 }
}
Write-Line '=== Windows firewall profiles ==='
Write-Line ("Host: {0}" -f $env:COMPUTERNAME)
Write-Line ''
try {
$profiles = @(Get-NetFirewallProfile -ErrorAction Stop)
} catch {
Write-Line 'Get-NetFirewallProfile failed'
Write-Line $_.Exception.Message
Write-Line 'Result: ERROR'
exit 2
}
$enabled = 0
foreach ($p in $profiles) {
$state = if ($p.Enabled) { 'on' } else { 'off' }
if ($p.Enabled) { $enabled++ }
Write-Line (" {0,-12} enabled={1} inbound={2} outbound={3}" -f $p.Name, $state, $p.DefaultInboundAction, $p.DefaultOutboundAction)
}
Write-Line ''
if ($profiles.Count -eq 0) {
Write-Line 'No firewall profiles returned'
Set-Warn
} elseif ($enabled -eq 0) {
Write-Line ' WARNING: all firewall profiles are disabled'
Set-Warn
} else {
Write-Line (" OK ({0} profile(s) enabled)" -f $enabled)
}
Write-Line ''
if ($status -eq 0) {
Write-Line 'Result: CURRENT'
} else {
Write-Line 'Result: ACTION NEEDED (firewall profiles disabled)'
}
exit $status
Raw endpointhttps://runny.sh/r/GHZDBZZK1TY9
See something unsafe?
Report this script
Tell us why it should come down. Anyone can also report a URL at /abuse.