This tutorial describes an unusual problem that may occur during Windows Server 2012 R2 Updates. This issue generally occurs while performing scheduled Windows Updates. Failure of one single update may keep you stuck you at the screen that says Updating your system, but will not move a single inch, even after hours of waiting with no progress. To overcome this challenge you can follow one of the methods popular among the system administrators. Here, we will see one of them.
1. Boot your server from Windows Server 2012 > click on Troubleshoot to enter in recovery mode console.
2. Run the following command to get a list of available drives:
wmic logicaldisk get name
3. The next step is to locate the drive that contains the windows directory. The easiest way to confirm is to check each drive for Windows directory by using “dir” command. Generally, Windows directory exists in the “C:” drive, however, if it’s located under different drive then simply replace “C:” with respective drive.
4. Navigate D:\Windows\WinSxS directory by using >> “cd Windows\Winsxs”
5. Check “pending.xml” file >> run “dir pending*” command
6. Now rename the “Pending” files to “_old” at the end of the file name >> enter “ren Pending.xml Pending_old.xml” command
7. Once you rename the “pending.xml” >> the next step is to create a new blank “Pending.xml” file by using: echo > pending.xml
8. Now navigate Windows directory
9. Create a new directory within Windows >> run “mkdir directoryname” where directory name can be a random choice by you. We will name the directory as scratch.
10. Use DISM (deployment image servicing and management) command. It will remove or revert all pending actions from the damaged image >> run below command:
DISM /Image: D:\ / Cleanup-Image / RevertPendingActions / scratchdir: D:\Windows\ scratch
11. Now rename the “SoftwareDistribution” folder to “SoftwareDistributionOLD” >> run below command:
Ren SoftwareDistribution SoftwareDistributionOLD
12. Run a system file checker tool to repair missing or corrupt kernel files by using the following command:
sfc /SCANNOW /OFFBOOTDIR=D:\ /OFFWINDIR=D:\Windows
13. Reboot the server
Note: If it is a virtual machine, make sure to take backup of “vhd” before making any changes on the server.