tacticalrmm/scripts/Win_Firewall_Check_Status.ps1

18 lines
327 B
PowerShell
Raw Normal View History

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