From fde2fff2326d88c06df8da57f0f6353582336016 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Wed, 5 Jul 2023 12:11:13 +0200 Subject: [PATCH] Update check-pending-reboot.ps1 --- Scripts/check-pending-reboot.ps1 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Scripts/check-pending-reboot.ps1 b/Scripts/check-pending-reboot.ps1 index 19b0d199..3eed3854 100755 --- a/Scripts/check-pending-reboot.ps1 +++ b/Scripts/check-pending-reboot.ps1 @@ -25,6 +25,7 @@ try { if ($IsLinux) { if (Test-Path "/var/run/reboot-required") { $Reason = "found /var/run/reboot-required" + Write-Host "⚠️ Pending reboot ($Reason)" } } else { if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") { @@ -57,14 +58,15 @@ try { if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "AvoidSpnSet") { $Reason += ", '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'" } + if ($Reason -ne "") { + Write-Host "⚠️ Pending reboot (registry contains $($Reason.substring(2)))" + } } - if ($Reason -ne "") { - Write-Host "⚠️ Pending reboot (registry contains $($Reason.substring(2)))" - } else { + if ($Reason -eq "") { Write-Host "✅ No pending reboot" } exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" exit 1 -} \ No newline at end of file +}