Sunday, 25 July 2021

Windows Server 2012 R2 is Stuck on "Updating Your System"

 


I had few Windows Server 2012 R2 to update. When I  was checking for updates, there were over 49 updates on one of the backup server, Most of them "Critical Update". So i had to update them and done so. Once all the updated  installed system forced me to restart. it was almost early morning 4am so i pushed the restart and went to bed. Morning since it was my backup server, non critical checked the systems and what i saw was surprising. Systems had a message " Updating your system (4%). Almost 6 hours it was at 4% and i realised its not going to work, unfortunately i didn't have any checkpoint to roll back too. 

After some google search i found an interesting step by step guide for workaround, Thank god it worked. 

Hera are the work around which worked for me. 

I have a Hyper-V environment. 


1) Turn off VM.

2) Adjust Autostart Settings (set a 5-second delay). - If not already done.

3) Power on VM in Safe Mode. Press F8 while booting the operating system. 


4) Choose "Troubleshoot" then "Command Prompt"

5) Enter the password for a local administrator account.

6) Next,  run the following command to see the list of all available drives:

     wmic logicaldisk get name


7) Next, we need to navigate to the C:\Windows\WinSxS

     cd Windows\Winsxs


8) Next, we need to list all files beginning with "Pending".

     dir pending*


9) Next, we need to rename all "Pending" files to append "_old

     ren Pending.xml Pending_old.xml


10) Next, we need to create a new blank "Pending.xml" file

     echo > pending.xml


11) Next, we need to navigate to the C:\Windows directory

    cd..


12) Next, we need to create a new directory within Windows called "scratch"

    mkdir scratch


13) Next, we need to run a DISM command to remove/revert all

   DISM /Image:C:\ /Cleanup-Image /RevertPendingActions /scratchdir:C:\Windows\Scratch


14) Next, we need to rename the "SoftwareDistribution" folder to "SoftwareDistributionOLD".

   ren C:\Windows\SoftwareDistribution C:\Windows\SoftwareDistributionOLD


15) Next, we need to run a system file checker tool 

    sfc /scannow


16) Lastly, we need to restart the VM




No comments:

Http vs Https