From 3a24e6e2c7102469d4cd489dbf0835f86c7aefd8 Mon Sep 17 00:00:00 2001 From: Danny de Kooker Date: Wed, 6 Sep 2023 15:20:28 +0200 Subject: [PATCH] Add Check_scripts/Win - Firewall status report.ps1 --- .../Win - Firewall status report.ps1 | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Check_scripts/Win - Firewall status report.ps1 diff --git a/Check_scripts/Win - Firewall status report.ps1 b/Check_scripts/Win - Firewall status report.ps1 new file mode 100644 index 0000000..7c0d785 --- /dev/null +++ b/Check_scripts/Win - Firewall status report.ps1 @@ -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 \ No newline at end of file