tacticalrmm/scripts/Win_Firewall_Check_Status.ps1

17 lines
325 B
PowerShell
Raw Normal View History

2021-04-10 17:44:02 +00:00
$ErrorActionPreference = 'silentlycontinue'
$fwenabled = (get-netfirewallprofile -policystore activestore).Enabled
if ($fwenabled.Contains('True')) {
Write-Output "Firewall is Enabled"
netsh advfirewall show currentprofile
exit 0
}
else {
Write-Host "Firewall is Disabled"
exit 1
}
Exit $LASTEXITCODE