PowerShell: Find if a computer is waiting for Reboot (pending reboot)


To find a computer is waiting for reboot to complete the Microsoft Update installation, I have found this information in Windows Update WMI object. This displays True (if Pending Reboot),or False (Not waiting for reboot).

(New-Object
-ComObject Microsoft.Update.SystemInfo).RebootRequired

But this only runs on the local computer. I needed to collect Pending Reboot state of all of our servers. That’s when I found this Gem – PowerShell Module – written by Brian Wilhite at Here.

It’s perfect. First you need to install this module on your local computer. Run this command on a elevated PowerShell (Run-As Administrator).

Install-Module -Name PendingReboot

You can close the elevated PowerShell. Use this module on your script to find Pending Reboot state and why it needs reboot.

Here is the example how it works:

PS E:\> Import-Module PendingReboot
PS E:> Test-PendingReboot -ComputerName SFOExch01 -Detailed -SkipConfigurationManagerClientCheck
ComputerName : SFOExch01
ComponentBasedServicing : False
PendingComputerRenameDomainJoin : False
PendingFileRenameOperations : True
PendingFileRenameOperationsValue : {\??\C:\Program Files\Common Files\Microsoft Shared\ClickToRun\ApiClient.dll.bak, , \??\C:\Program Files\Common Files\Microsoft
Shared\ClickToRun\C2RINTL.en-us.dll.bak, …}
SystemCenterConfigManager :
WindowsUpdateAutoUpdate : False
IsRebootPending : True
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s