22. SYNOPSIS
33 Check for pending reboots
44. DESCRIPTION
5- This PowerShell script queries pending reboots and prints it.
5+ This PowerShell script queries pending operating system reboots and prints it.
66. EXAMPLE
77 ./check-pending-reboot.ps1
88. LINK
@@ -28,19 +28,19 @@ try {
2828 }
2929 } else {
3030 if (Test-Path - Path " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" ) {
31- $Reason += " , ' ...\WindowsUpdate\ Auto Update\RebootRequired' "
31+ $Reason += " , ...\Auto Update\RebootRequired"
3232 }
3333 if (Test-Path - Path " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting" ) {
34- $Reason += " , ' ...\WindowsUpdate\ Auto Update\PostRebootReporting' "
34+ $Reason += " , ...\Auto Update\PostRebootReporting"
3535 }
3636 if (Test-Path - Path " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" ) {
37- $Reason += " , ' ...\Component Based Servicing\RebootPending' "
37+ $Reason += " , ...\Component Based Servicing\RebootPending"
3838 }
3939 if (Test-Path - Path " HKLM:\SOFTWARE\Microsoft\ServerManager\CurrentRebootAttempts" ) {
40- $Reason += " , ' ...\ServerManager\CurrentRebootAttempts' "
40+ $Reason += " , ...\ServerManager\CurrentRebootAttempts"
4141 }
4242 if (Test-RegistryValue - Path " HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing" - Value " RebootInProgress" ) {
43- $Reason += " , ' ...\CurrentVersion\Component Based Servicing' with 'RebootInProgress'"
43+ $Reason += " , ...\CurrentVersion\Component Based Servicing with 'RebootInProgress'"
4444 }
4545 if (Test-RegistryValue - Path " HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing" - Value " PackagesPending" ) {
4646 $Reason += " , '...\CurrentVersion\Component Based Servicing' with 'PackagesPending'"
5959 }
6060 }
6161 if ($Reason -ne " " ) {
62- Write-Host " ⚠️ Pending reboot (found $ ( $Reason.substring (2 )) in registry )"
62+ Write-Host " ⚠️ Pending reboot (registry contains $ ( $Reason.substring (2 )) )"
6363 } else {
6464 Write-Host " ✅ No pending reboot"
6565 }
0 commit comments