mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-11 16:39:10 +01:00
Update check-pending-reboot.ps1
This commit is contained in:
parent
e15be92a54
commit
fde2fff232
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user