Pending reboot detection across Windows servers
A read-only pending reboot check for Windows servers before patching, application installs, or maintenance-window closure.
Good For
patch readiness
maintenance windows
post-update validation
server handoff
reboot planning
How to Use It
Run the check before a patch window to identify hosts that already show common reboot indicators.
If Component Based Servicing is pending, review recent Windows servicing or feature-install activity.
If Windows Update is pending, compare with the patching tool and maintenance-window schedule.
If pending file rename operations exist, review recent driver, antivirus, backup-agent, or application installs.
Treat these as common signals rather than a single universal reboot API; exceptions still require operator judgment.
After an approved reboot, run the same check again and record which signals cleared.
Execution Modes
- local
- remote-single-host
- remote-host-list
- ad-filtered
Inputs and Outputs
Inputs
- computer name
- CSV or TXT server list
- Active Directory server scope
- PowerShell remoting access
- maintenance-window notes
Outputs
- verbose-console
- csv
Command Starter
Writes local output artifacts: review the output path before running
# ---------------------------------------------------------------------
# Operator inputs
# ---------------------------------------------------------------------
$ComputerNames = @('server01')
$OutputPath = '.\pending-reboot-results.csv'
# ---------------------------------------------------------------------
# Query common reboot indicators from each server
# ---------------------------------------------------------------------
$Results = foreach ($ComputerName in $ComputerNames) {
try {
Invoke-Command -ComputerName $ComputerName -ErrorAction Stop -ScriptBlock {
$CbsPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending'
$WuPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired'
$SessionManagerPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager'
# Read the actual pending-rename value, not merely whether the property lookup returned an object.
$PendingRenameValue = (Get-ItemProperty -Path $SessionManagerPath -Name PendingFileRenameOperations -ErrorAction SilentlyContinue).PendingFileRenameOperations
[pscustomobject]@{
ComputerName = $env:COMPUTERNAME
ComponentBasedServicing = Test-Path -Path $CbsPath
WindowsUpdate = Test-Path -Path $WuPath
PendingFileRename = [bool]$PendingRenameValue
AnyPendingRebootSignal = (Test-Path -Path $CbsPath) -or (Test-Path -Path $WuPath) -or [bool]$PendingRenameValue
}
}
}
catch {
[pscustomobject]@{
ComputerName = $ComputerName
ComponentBasedServicing = $null
WindowsUpdate = $null
PendingFileRename = $null
AnyPendingRebootSignal = $null
Error = $_.Exception.Message
}
}
}
$Results | Export-Csv -Path $OutputPath -NoTypeInformation -Encoding UTF8
$Results | Format-Table -AutoSizeValidation
Every checked server has a recorded true or false result for each pending reboot signal.
Approved reboots clear the expected pending signals after the host returns.
Servers that remain pending have a documented owner, reason, and next maintenance window.
Reporting
Attach the CSV to the patch-window record when multiple servers are checked.
Include uncleared pending reboot indicators in handoff notes.
Use the shared reporting foundation when you want consistent HTML, CSV, JSON, and log artifacts before maintenance.
Safety Notes
This check reports reboot state only; it does not restart servers.
Do not schedule or force reboots from this evidence pass without change approval and application-owner confirmation.
