@echo off setlocal EnableExtensions where powershell.exe >nul 2>nul if errorlevel 1 ( echo PowerShell not found. exit /b 2 ) echo Windows Firewall profiles powershell.exe -NoProfile -Command "$p = Get-NetFirewallProfile -ErrorAction Stop; $p | Select-Object Name, Enabled, DefaultInboundAction, DefaultOutboundAction | Format-Table -AutoSize; if (@($p | Where-Object { -not $_.Enabled }).Count -gt 0) { exit 1 }" set "code=%errorlevel%" if not "%code%"=="0" ( echo One or more firewall profiles are disabled. ) exit /b %code%