diff --git a/Scripts/check-firewall.ps1 b/Scripts/check-firewall.ps1 new file mode 100644 index 00000000..253dc2bc --- /dev/null +++ b/Scripts/check-firewall.ps1 @@ -0,0 +1,31 @@ +<# +.SYNOPSIS + Check the firewall +.DESCRIPTION + This PowerShell script queries and prints firewall details. +.EXAMPLE + PS> ./check-firewall + ✅ AMD Ryzen 5 5500U with Radeon Graphics (CPU0, 2100MHz, 31.3°C) +.LINK + https://github.com/fleschutz/PowerShell +.NOTES + Author: Markus Fleschutz | License: CC0 +#> + +try { + if ($IsLinux) { + # TODO + } else { + $enabled = (gp 'HKLM:\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\DomainProfile').EnableFirewall + if ($enabled) { + Write-Host "✅ Firewall enabled" + } else { + Write-Host "⚠️ Firewall disabled" + } + } + + exit 0 # success +} catch { + "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +} \ No newline at end of file diff --git a/Scripts/check-health.ps1 b/Scripts/check-health.ps1 index a040482e..22c6e249 100755 --- a/Scripts/check-health.ps1 +++ b/Scripts/check-health.ps1 @@ -34,6 +34,7 @@ & "$PSScriptRoot/check-pending-reboot.ps1" " " & "$PSScriptRoot/write-green.ps1" " N E T W O R K" +& "$PSScriptRoot/check-firewall" & "$PSScriptRoot/check-ping.ps1" & "$PSScriptRoot/check-dns.ps1" & "$PSScriptRoot/check-vpn.ps1"