Computer and IT knowledge - things to know
powershell script:
$rebootPending = $false
# check for pending reboot in registry keys
$keys = @(
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired",
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Pending"
)
foreach ($key in $keys) {
if (Test-Path $key) {
$rebootPending = $true
break
}
}
if ($rebootPending) {
Write-Host "1 PendingReboot - Reboot pending"
} else {
Write-Host "0 PendingReboot - No reboot pending"
}
computer2know :: thank you for your visit :: have a nice day :: © 2025