2
2
. SYNOPSIS
3
3
Check for pending reboots
4
4
. DESCRIPTION
5
- This PowerShell script queries pending reboots and prints it.
5
+ This PowerShell script queries pending operating system reboots and prints it.
6
6
. EXAMPLE
7
7
./check-pending-reboot.ps1
8
8
. LINK
@@ -28,19 +28,19 @@ try {
28
28
}
29
29
} else {
30
30
if (Test-Path - Path " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" ) {
31
- $Reason += " , ' ...\WindowsUpdate\ Auto Update\RebootRequired' "
31
+ $Reason += " , ...\Auto Update\RebootRequired"
32
32
}
33
33
if (Test-Path - Path " HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting" ) {
34
- $Reason += " , ' ...\WindowsUpdate\ Auto Update\PostRebootReporting' "
34
+ $Reason += " , ...\Auto Update\PostRebootReporting"
35
35
}
36
36
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"
38
38
}
39
39
if (Test-Path - Path " HKLM:\SOFTWARE\Microsoft\ServerManager\CurrentRebootAttempts" ) {
40
- $Reason += " , ' ...\ServerManager\CurrentRebootAttempts' "
40
+ $Reason += " , ...\ServerManager\CurrentRebootAttempts"
41
41
}
42
42
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'"
44
44
}
45
45
if (Test-RegistryValue - Path " HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing" - Value " PackagesPending" ) {
46
46
$Reason += " , '...\CurrentVersion\Component Based Servicing' with 'PackagesPending'"
59
59
}
60
60
}
61
61
if ($Reason -ne " " ) {
62
- Write-Host " ⚠️ Pending reboot (found $ ( $Reason.substring (2 )) in registry )"
62
+ Write-Host " ⚠️ Pending reboot (registry contains $ ( $Reason.substring (2 )) )"
63
63
} else {
64
64
Write-Host " ✅ No pending reboot"
65
65
}
0 commit comments