2
0

Add Check_scripts/Win - Firewall status report.ps1

This commit is contained in:
2023-09-06 15:20:28 +02:00
parent afc2392556
commit 3a24e6e2c7

View File

@@ -0,0 +1,41 @@
<#
.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