Update check-pending-reboot.ps1

This commit is contained in:
Markus Fleschutz 2023-01-13 17:59:15 +01:00
parent 7e777f07ee
commit 1e3265b02b

View File

@ -22,6 +22,11 @@ function Test-RegistryValue { param([parameter(Mandatory=$true)][ValidateNotNull
try {
$Reason = ""
if ($IsLinux) {
if (Test-Path "/var/run/reboot-required") {
$Reason = "found /var/run/reboot-required"
}
} else {
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") {
$Reason += ", found registry entry '...\WindowsUpdate\Auto Update\RebootRequired'"
}
@ -55,6 +60,7 @@ try {
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "AvoidSpnSet") {
$Reason += ", found registry entry '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
}
}
if ($Reason -ne "") {
Write-Host "⚠️ Pending reboot ($($Reason.substring(2)))"
} else {