Boot up the server, get to the boot menu with F8 and choose "recovery options" or "recover servers
- Choose "Troubleshoot" then "Command Prompt"
- Select Administrator account then enter the password for a local administrator account.
- List of all available drives: wmic logicaldisk get name
- 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.
In my case this was F: - note that usually X: is the recovery image - Next, we need to navigate to the C:\Windows\WinSxS directory by using the following command:
cd Windows\Winsxs - Next, we need to list all files beginning with "Pending". To do this, we can use the following command: dir pending*
- 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" (pay close attention to the syntax): ren Pending.xml Pending_old.xml
- 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
- Next, we need to navigate to the C:\Windows directory. To do this, we will use the following command (which simply navigates up one level): cd..
- Next, we need to create a new directory within Windows called "helpme", which is required for the next step. To do this, we will use the following command: mkdir helpme
- 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:\Windows\helpme
If you get an error about not being able to DISM you are using the X: - the image is NOT ONLINE !!! - Next, we need to rename the "SoftwareDistribution" folder to "SoftwareDistributionOLD". To do this, we will use the following command: ren C:\Windows\SoftwareDistribution C:\Windows\SoftwareDistributionOLD
- Next, we need to run a system file checker tool to repair missing or corrupt system files. To do this, we will use the following command: sfc /scannow
- Lastly, we need to restart the server, the process may take slightly longer than normal, but after 30-60 seconds, you will see something looking like this: