mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-15 11:10:54 +01:00
Added check-firewall.ps1
This commit is contained in:
parent
f3cc8de619
commit
047ef6526d
31
Scripts/check-firewall.ps1
Normal file
31
Scripts/check-firewall.ps1
Normal file
@ -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
|
||||
}
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user