Installing updates on Windows 10 when Windows Update fails to install

in #windows3 years ago (edited)

Prerequisites:

  • Windows installer image from:
    • Windows Media Creation Tool
    • Windows installation disc
    • USB memory stick
    • copied to hard disk
  • individual updates as *.msu or *.cab files in "%USERPROFILE%\Downloads"
  • Command Prompt opened as Administrator

NOTES:

  1. You can skip creating some directories if they already exist.
  2. Steemit might split some commands as multiple lines, but each command must be entered as single line.

Step 1

Extract all *.cab files from all *.msu files

For example:

cd %USERPROFILE%\Downloads
md KB5004237
expand -f:* "windows10.0-kb5004237-x64_9a7c569f5656d99533e9e945e8063251758ce4c0.msu" KB5004237
cd KB5004237
md KB5004237
expand -f:* "Windows10.0-KB5004237-x64.cab" KB5004237
cd KB5004237
dir update.*

Step 2

If you don't have install.wim, mount ISO image created by Windows Media Creation Tool or insert Windows 10 DVD in drive or plug in USB memory stick.

Convert install.esd to install.wim: (assuming the Windows installer is drive E: and you have Windows 10 Home)

md C:\$Windows.~WS
md C:\$Windows.~WS\Sources
Dism /Export-Image /SourceImageFile:E:\sources\install.esd /SourceIndex:1 /DestinationImageFile:C:\$Windows.~WS\Sources /Compress:Max /CheckIntegrity

For other Windows versions, you need to check the image index using:

Dism /Get-WimInfo /WimFile:E:\sources\install.esd

Step 3

Copy everything from drive E: except sources\install.esd to C:\$Windows.~WS\.

You can select all directories except sources and copy them first, then open sources directory, sort by size and select everything except install.esd, and copy its contents to C:\$Windows.~WS\Sources.

Step 4

Apply updates to install.wim:

md C:\install
Dism /Mount-Image /ImageFile:C:\$Windows.~WS\Sources\install.wim /Name:"Windows 10 Home" /MountDir:C:\install

Change to the directory containing update.mum starting from lowest KB number, for example %USERPROFILE%\Downloads\KB5004237\KB5004237 created above:

cd "%USERPROFILE%\Downloads\KB5004237\KB5004237"
Dism /Image:C:\install /Add-Package /PackagePath:.

Repeat for all other updates.

Step 5

Refresh install.wim to integrate all updates:

md c:\temp
Dism /Cleanup-Image /Image:"C:\install" /StartComponentCleanup /ResetBase /ScratchDir:C:\temp
Dism /Unmount-Image /MountDir:C:\install /Commit

Step 6

Run setup.exe in directory C:\$Windows.~WS.

Windows will restart after backing up files and start installing updates.