How To Fix Windows Update When it Breaks
Windows updates are a monthly fact of life for IT Pros. A properly updated system offers the best protection possible from malware. Updated systems often offer better performance than other PCs running outdated drivers or software. The Windows Update technology built into the Windows OS is a key component to keeping systems patched. When Windows Update breaks, the updating process tends to as well. I recently faced this challenge.
The problem started while trying to update my office PC. My daily work PC runs Windows 8.1 Pro with the Windows 8.1 Update applied. The Windows 8.1 Update is required in order to apply future Windows patches and updates.
For consumers, the deadline to install the update is June 10th, 2014. Enterprises have a bit longer with an August 12th, 2014 deadline. In an almost laughable twist of irony it was the Windows 8.1 Update that broke the Windows Update process on my computer. This doesn’t happen on the majority of PCs but that fact offered me little consolation.
Here are the steps I followed to fix Windows Update:
1. Begin the repair process by opening an elevated Command or PowerShell prompt. I recommend PowerShell. In Windows 8.1 there are a number of ways to run PowerShell. One method is to simultaneously press the Windows key + Q on the keyboard to open the Search Charm. Type PowerShell, right click Windows PowerShell in the results list, and then click Run as administrator.
Running an elevated PowerShell prompt
2. Click Yes when prompted to allow PowerShell to run.
3. Windows 8.1 includes utilities out-of the box that can resolve most issues encountered with Windows Update. The first such tool to use is Chkdsk. Chkdsk verifies file integrity on the hard drive and resolves logical file system errors. Run chkdsk /r to deal with any corruption. Don’t be surprised if the system asks you to schedule chkdsk for the next reboot. This is to provide the utility with exclusive disk access. When prompted about scheduling chkdsk, type Y and press Enter.
Scheduling CHKDSK to run at the next reboot
4. Type Exit to quit PowerShell, press Enter, and then restart the PC.
Depending on the size of the PC’s hard drive, chkdsk can take a few hours to complete. Staring at the screen for this long could be detrimental to your health. It’s akin to the excitement of watching paint dry. I suggest running chkdsk overnight in an effort to preserve your sanity.
CHKDSK running at system boot
5. Next, use the System File Checker utility to repair any missing or damaged Windows system files. Open an elevated PowerShell prompt as before, type sfc /scannow and press Enter. Expect this process to run for ten to fifteen minutes. Consider this Microsoft’s way of giving you a coffee break.
Using the System File Checker
The next steps require the Windows installation media. This can be a DVD, USB drive, or ISO file. An ISO file is basically a DVD but without the hassle of keeping track of the physical disk. Using an ISO is as simple as right clicking the file, clicking Mount, and a new drive letter will appear in File Explorer just as if the Windows 8.1 Pro with Update DVD had been inserted in a DVD drive. ISO files are particularly handy for those with systems sans optical drive.
6. Insert the Windows DVD or simply mount the Windows ISO. In my case, I’ll mount the Windows 8.1 Pro with Update ISO by opening File Explorer, navigating to the ISO file, right-clicking the ISO file, and then clicking Mount.
Mounting an ISO file in File Explorer
7. In File Explorer, take note of the drive letter assigned to the Windows OS DVD. As I mentioned, mounting an ISO file is just like inserting a physical DVD so a drive letter will be assigned either way.
Noting the mounted ISO file’s drive letter
8. It’s now time to begin cleaning up the Windows Component Store using the Deployment Image Servicing and Management tool (DISM). DISM is usually used to maintain Windows deployment images but it’s also very helpful when working on certain problems with a running Windows system.
In addition to the DISM.exe command-line utility, DISM has a handy PowerShell module included with Windows 8.1 and Windows Server 2012 R2. For other supported operating systems, you can install the latest version of the Windows Assessment and Deployment Kit (Windows ADK) which includes the DISM PowerShell module. Install PowerShell 4.0 on these systems too. PowerShell 4.0 is part of the Windows Management Framework 4.0 which can be downloaded from http://www.microsoft.com/en-us/download/details.aspx?id=40855.
Return to the elevated PowerShell prompt you opened earlier. Begin using DISM with the /cleanup-image and the /startcomponentcleanup switches. The /online switch is specified so that DISM knows to work with the current running Windows installation. This process can take an hour or longer depending on the system.
Type dism /online /cleanup-image /startcomponentcleanup and press Enter.
Running DISM.exe with the /startcomponentcleanup switch
9. Using the Mount-WindowsImage cmdlet, mount the install.wim file from the Windows OS DVD so it can be used as the source for repair files. By default, DISM uses Windows Update as the source for these files but in this case, this is a paradox. Windows Update is broken which is why we’re doing all this in the first place. In the elevated PowerShell session run the following cmdlet:
Mount-WindowsImage –ImagePath E:sourcesinstall.wim –Index 1 –Path C:OfflineMount –LogPath C:TempMount.log -ReadOnly
Tip: Be certain the folder specified in the –Path parameter exists and is empty before running the Mount-WindowsImage cmdlet. Otherwise the cmdlet will throw an error.
Mounting the install.wim file for use with DISM
Be patient. Mounting the image may take a minute or two.
10. It is now time to repair any Component Store corruption. This is the job of the Repair-WindowsImage cmdlet. Start out by using Repair-WindowsImage along with the –ScanHealth parameter. Type the following cmdlet in the elevated PowerShell session and press Enter.
Repair-WindowsImage –Online –ScanHealth –LogPath C:TempScanHealth.log
Using the Repair-WindowsImage cmdlet with the -ScanHealth parameter
11. Once this cmdlet is finished running, run Repair-WindowsImage again. This time use the –RestoreHealth parameter. Type the following cmdlet, then press Enter:
Repair-WindowsImage –Online -RestoreHealth -Source C:OfflineMountWindowsWinSxS -LimitAccess -LogPath C:TempRepair.log
Using the Repair-WindowsImage cmdlet with the -RestoreHealth parameter
12. Run the Repair-WindowsImage cmdlet with the –ScanHealth parameter again. When it completes, the results should now show the image in a Healthy state.
Type Repair-WindowsImage –Online –ScanHealth –LogPath C:TempScanHealth.log and press Enter.
Using the Repair-WindowsImage cmdlet with the -ScanHealth parameter
13. Great! Everything is working thus far. Now, unmount the install.wim image using the Dismount-WindowsImage cmdlet. Type Dismount-WindowsImage -Discard –Path C:OfflineMount –LogPath C:TempDismount.log and press Enter.
Dismounting the install.wim file from DISM using the Dismount-WindowsImage cmdlet
14. Type Exit and hit Enter to quit PowerShell and return to the Desktop.
15. Finish up by opening File Explorer, right clicking the DVD Drive, (which is really just the mounted ISO file), and then click Eject.
Dismounting the ISO file from File Explorer
Windows Update should now function normally.
With help from DISM and a little know how, fixing Windows Update corruption doesn’t have to be a major undertaking. It may take a few hours to run all the commands, but doing so is better than reloading a system. It’s definitely better than leaving a system unpatched and at risk!
More in PowerShell
How to Create Files and Folders with PowerShell
Jun 22, 2022 | Mike Kanakos
How to Use PowerShell For Loop, While Loop, and Other Loops
May 23, 2022 | Ivan Mirchev
How to Check Your PowerShell Version
May 4, 2022 | Michael Reinders
How to Download a File using PowerShell
Apr 21, 2022 | Michael Reinders
How to Write and Run a PowerShell Script File on Windows 11
Apr 4, 2022 | Ivan Mirchev
Microsoft’s New PowerShell Crescendo Tool Facilitates Native Command-Line Wraps
Mar 21, 2022 | Rabia Noureen
Most popular on petri