Add Check_scripts/Win - Firewall status report.ps1
This commit is contained in:
41
Check_scripts/Win - Firewall status report.ps1
Normal file
41
Check_scripts/Win - Firewall status report.ps1
Normal 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
|
||||||
Reference in New Issue
Block a user