Skip to content

Commit

Permalink
Update check-pending-reboot.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
fleschutz committed Jun 13, 2023
1 parent 2ae5c5e commit 02171a4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Scripts/check-pending-reboot.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.SYNOPSIS
Check for pending reboots
.DESCRIPTION
This PowerShell script queries pending reboots and prints it.
This PowerShell script queries pending operating system reboots and prints it.
.EXAMPLE
./check-pending-reboot.ps1
.LINK
Expand All @@ -28,19 +28,19 @@ try {
}
} else {
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") {
$Reason += ", '...\WindowsUpdate\Auto Update\RebootRequired'"
$Reason += ", ...\Auto Update\RebootRequired"
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting") {
$Reason += ", '...\WindowsUpdate\Auto Update\PostRebootReporting'"
$Reason += ", ...\Auto Update\PostRebootReporting"
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending") {
$Reason += ", '...\Component Based Servicing\RebootPending'"
$Reason += ", ...\Component Based Servicing\RebootPending"
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\ServerManager\CurrentRebootAttempts") {
$Reason += ", '...\ServerManager\CurrentRebootAttempts'"
$Reason += ", ...\ServerManager\CurrentRebootAttempts"
}
if (Test-RegistryValue -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing" -Value "RebootInProgress") {
$Reason += ", '...\CurrentVersion\Component Based Servicing' with 'RebootInProgress'"
$Reason += ", ...\CurrentVersion\Component Based Servicing with 'RebootInProgress'"
}
if (Test-RegistryValue -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing" -Value "PackagesPending") {
$Reason += ", '...\CurrentVersion\Component Based Servicing' with 'PackagesPending'"
Expand All @@ -59,7 +59,7 @@ try {
}
}
if ($Reason -ne "") {
Write-Host "⚠️ Pending reboot (found $($Reason.substring(2)) in registry)"
Write-Host "⚠️ Pending reboot (registry contains $($Reason.substring(2)))"
} else {
Write-Host "✅ No pending reboot"
}
Expand Down

0 comments on commit 02171a4

Please sign in to comment.