After installing certain patches or security updates on Windows, a restart may be required for them to take effect. However, if users continually postpone rebooting their computers or if the automatic reboot after updates is disabled on servers/workstations (for example, via the Windows Update Group Policy), hosts may remain with installed but unapplied updates pending a restart. In large enterprise networks, dozens of devices often remain stuck in PendingReboot status for weeks, posing a significant operational challenge. Let’s look at how to find computers on the network that are waiting for a reboot after installing updates.
In my case, the Windows Server host has completed the installation of updates but has not yet rebooted. It shows a Pending restart status in the Windows Update control panel.
The PendingReboot module from the PowerShell Gallery can be used to query a computer’s pending restart status. To install this PowerShell module, run the command:
Install-Module -Name PendingReboot
Check if your computer requires a restart:
Test-PendingReboot
IsRebootPending: True
Adding the -Detailed option causes the cmdlet to display extra information, including the reason for the pending reboot (whether it is due to installing updates, joining a domain, or installing/removing roles and features).
Test-PendingReboot -Detailed
ComponentBasedServicing : True PendingComputerRenameDomainJoin : False PendingFileRenameOperations : False PendingFileRenameOperationsValue : SystemCenterConfigManager : WindowsUpdateAutoUpdate : True IsRebootPending : True
You can use the Invoke-Command cmdlet (PowerShell Remoting must be enabled and configured) to check whether a reboot is required on a remote computer.
Invoke-Command -ComputerName m-dc01 -ScriptBlock {Test-PendingReboot}
If you don’t want to install any extra PowerShell modules, you can check the status of the pending reboot in the registry. The presence of entries in the following registry keys indicates that a restart is required:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPendingHKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequiredHKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperationsHKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations2
For example, you can use the command below to check for a pending reboot entry:
Get-Item 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired' -ErrorAction SilentlyContinue
If the parameter is present under the RebootRequired registry key, it indicates that the host requires a reboot.
Here is an example of a PowerShell function to check for the presence of parameters in these registry keys:
function Get-PendingReboot {
param([string[]]$ComputerName = "localhost")
foreach ($Computer in $ComputerName) {
$HKLM = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $Computer)
$CBS = $HKLM.OpenSubKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending')
$WU = $HKLM.OpenSubKey('SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired')
$SM = $HKLM.OpenSubKey('SYSTEM\CurrentControlSet\Control\Session Manager')
$Rename = $SM.GetValue('PendingFileRenameOperations')
$Rename2 = $SM.GetValue('PendingFileRenameOperations2')
[PSCustomObject]@{
Computer = $Computer
RebootNeeded = [bool]($CBS -or $WU -or $Rename -or $Rename2)
}
}
}
This function will allow you to check whether the local computer requires a reboot. You can also check the pending reboot status on several remote machines at once.
Get-PendingReboot "m-fs01","m-fs02","m-dc01"





