2
0
Files
TacticalRMM_Scripts/Check_scripts/Win - Firewall status report.ps1

41 lines
1.0 KiB
PowerShell

<#
.SYNOPSIS
Check the status of Windows firewall and report back to TRMM
.DESCRIPTION
This script will check the status of the windows firwall and report this back, this script shoudl be deployed as a Check Script.
.OUTPUTS
This script will return an error message when the firewall is turned off.
Errorcodes:
0 - All OK
1 - Firewall is Disabled
.EXAMPLE
Win - Firewall status report.ps1
.NOTES
Source: Tactical RMM repository
.CHANGELOG
24-06-2022 - Copied from TRMM repo
#>
#region Parameters, functions and global variables
$ErrorActionPreference = 'silentlycontinue'
$fwenabled = (get-netfirewallprofile -policystore activestore).Enabled
#endregion
#region script
if ($fwenabled.Contains('False')) {
Write-Output "Firewall is Disabled"
exit 1
}
else {
Write-Host "Firewall is Enabled"
netsh advfirewall show currentprofile
exit 0
}
Exit $LASTEXITCODE
#endregion