The Pending Reboot Nightmare… PowerShell to the Rescue!

My company has been having issues dealing with servers in a pending reboot state for quite a while.  Part of it stems from using SCCM to deploy patches and having the patch deployment set to suppress the reboot and our Operations Team reboots the servers manually.  Well, some months require multiple reboots and we get stuck in the rabbit hole trying to get caught up by the next month’s round of patching!

I found a PowerShell Module that I’ve found VERY handy in finding the Pending Reboot State of servers.

The module is called, “PendingReboot” and can be installed from the PowerShell Gallery!

Install-Module PendingReboot -Confirm:$false

The cmdlet to use to check the pending reboot state of your servers is:  Test-PendingReboot


Test the pending reboot status on a local and/or remote computer.

Test-PendingReboot [[-ComputerName] <String[]>] [-Credential <PSCredential>] [-Detailed]
[-SkipConfigurationManagerClientCheck] [-SkipPendingFileRenameOperationsCheck] [<CommonParameters>]

This function will query the registry on a local and/or remote computer and determine if the
system is pending a reboot, from Microsoft/Windows updates, Configuration Manager Client SDK, Pending
Computer Rename, Domain Join, Pending File Rename Operations and Component Based Servicing.

ComponentBasedServicing = Component Based Servicing
WindowsUpdate = Windows Update / Auto Update
CCMClientSDK = SCCM 2012 Clients only (DetermineifRebootPending method) otherwise $null value
PendingComputerRenameDomainJoin = Detects a pending computer rename and/or pending domain join
PendingFileRenameOperations = PendingFileRenameOperations, when this property returns true, it can be a false positive
PendingFileRenameOperationsValue = PendingFilerenameOperations registry value; used to filter if need be, Anti-Virus will leverage this key property for def/dat removal, giving a false positive


Component-Based Servicing:

PendingFileRename/Auto Update:


To see the examples, type: “get-help Test-PendingReboot -examples”.
For more information, type: “get-help Test-PendingReboot -detailed”.
For technical information, type: “get-help Test-PendingReboot -full”.
For online help, type: “get-help Test-PendingReboot -online”

Here, I ran the command against a VM that I already knew to be in a pending reboot state.

Test-PendingReboot -ComputerName (Get-VM VM1)

ComputerName               IsRebootPending
————                          —————
VM1                                 True

I love that I can use this against my already connected VMware vCenter servers and query via SRM Tiers, Storage Tiers, etc.

Test-PendingReboot -ComputerName (get-folder "SRM_Tier_01" | Get-VM)

ComputerName               IsRebootPending
————                          —————
Server1                            True
Server2                            False
Server3                            False

Or you can do it by Datastore Cluster

Test-PendingReboot -ComputerName (Get-DatastoreCluster "DatastoreCluster1" | Get-VM)

ComputerName               IsRebootPending
————                          —————
Server4                            False
Server5                            True
Server6                            True

This made my life a whole lot easier.  🙂

I hope someone else finds this handy like I did!


Ben Liebowitz, VCP, vExpert
NJ VMUG Leader

Share This:

5 thoughts on “The Pending Reboot Nightmare… PowerShell to the Rescue!

  1. Hello,
    I realised my first comment was not very polite. This module is brilliant I am just starting to try it out, I am new to powershell and wondered is it possible to get the results out to csv or excel please?

    1. No worries, Marc.

      You should be able to pipe it out to a CSV. I haven’t tried.

      Test-Pendingreboot -Computername (Get-VM VM1) | export-csv -notypeinformation c:\pendingreboot.csv

Leave a Reply to KenO Cancel reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.