Windows Server 2012 R2 stuck in reboot cycle due to failed updates

Windows Server 2012 R2 is Stuck on “Updating Your System”

At the time of updating patches on virtual machine running on a Microsoft Hyper-V platform if one of the updates had failed, and all pending updates were going to be undone. After about an hour of “undoing changes”, the Servers restarted. The following screen appeared, and stayed there, even after hours of waiting, with no progress being made:
Windows Server Updating System

Steps to fix:

1) Turn off VM.
2) Go into the VM settings and adjust the “Automatic start delay” option, set 5 second delay so that we have more time to press the F8 key when we turn on the VM

VM Setting

3) Power on VM and press the F8 key, following menu will appear:
4) Choose “Troubleshoot” then “Command Prompt”
5) When prompted, you will need to enter the password for a local administrator account.
6) Next, we need to run the following command to get a list of all available drives: wmic logicaldisk get name

7)  Next, we need to locate the drive that contains the Windows directory. This may or may not be the C: drive listed. The easiest way to confirm is to check each drive letter for the Windows directory by using the “dir” command. The following instructions assume the Windows directory exists on the C: drive. Yours may differ. If it does, simply replace “C” with your drive letter.
8)  Next, we need to navigate to the C:WindowsWinSxS directory by using the following Command:  cd WindowsWinsxs9)  Next, we need to list all files beginning with “Pending”. To do this, we can use the following Command: dir pending*

10) Next, we need to rename all “Pending” files to append “_old” to the end of the file name. Here is a sample command that will rename “Pending.xml” to “Pending_old.xml”:
ren Pending.xml Pending_old.xml

11)  Next, we need to create a new blank “Pending.xml” file, which will be required steps to come later. We do this with the following Command: echo > pending.xml

12) Next, we need to navigate to the C:Windows directory.

13) Next, we need to create a new directory within Windows called “scratch”. To do this, we will use the following command: mkdir scratch

14) Next, we need to run a DISM command to remove/revert all pending actions from the damaged image. In my case, these are the failed updates which are attempting to install. To do this, we will use the following Command:
 DISM /Image:C: /Cleanup-Image /RevertPendingActions  /scratchdir:C:WindowsScratch
15) Next, we need to rename the “SoftwareDistribution” folder to “SoftwareDistributionOLD”. To do this, we will use the following Command:
ren C:WindowsSoftwareDistribution C:WindowsSoftwareDistributionOLD16) Next, we need to run a system file checker tool to repair missing or corrupt system files. Run following Command: sfc /scannow
Undoing Change Patch

17) Lastly, we need to restart the VM. The process may take slightly longer than normal, after some time, below window will show: Once this process has completed, Windows Server will be back to normal state.

Windows Server 2012 R2 Normal Boot

 

Leave a comment