Fix Windows 10 Update Failures, e.g. Error 0x800f081f
Try running DISM and SFC commands to repair Windows system files. Once complete reboot and try running the update again.
DISM /Online /Cleanup-image /RestoreHealth
The above DISM command typically completes without issues, but if there are problems replacing the damaged files, you will need to provide another image using the Source option to complete the task. You can use an “install.wim” or “install.esd” file from another computer, bootable install media, or Windows 10 iso file. Make sure that the files match the version, edition of Windows 10 you are trying to fix, e.g. Win10_21H2_English_x64.iso where version 21H2 matches your current Windows version.
Example with a mounted Windows 10 iso source assigned to drive E: and where install.win:1 (Pro edition) index number obtained from DISM Get-WinInfo command
DISM /Get-WimInfo /WimFile:E:\sources\install.wim DISM /Online /Cleanup-Image /RestoreHealth /Source:wim:E:\Sources\install.wim:1 /LimitAccess
DISM (Deployment Image Servicing and Management) manages both Windows Online and Offline Images and repairs system files
- /Online switch instructs DISM to target the running Operating System instead of an offline Windows image (.wim) file or virtual hard disk (.vhd or .vhdx)
- /Cleanup-Image switch performs cleanup and recovery operations on the running Operating System
- /Restorehealth switch scans the running Operating System for corrupt files and attempts to fix them
- /LimitAcess optional parameter which tells DISM not to use Windows Update service to retrieve corrupted or missing files
SFC (System File Checker)
- /Scannow will scan all protected system files, and replace corrupted files with a cached copy that is located in a compressed folder at %WinDir%\System32\dllcache
The above procedure also fixes Windows Defrag not running properly due to corrupt system files.