Windows Update error 0x800F081F

Seems I've encountered this issue several times over the last few weeks with Windows Server 2012.  I attempt to install updates and the progress bar will hang, essentially stalling out.  I cancel, I restart but I end up in the same place.

When I first saw this issue, I read something about setting updates to install automatically in the middle of the night which managed to get the updates installed but it doesn't actually solve the problem.


I've gone as far as installing one at a time and sometimes that has worked but in my most recent experience, I was unable to get anywhere.  Coupled with the need to install a Windows 'feature' which, for the same reason, would not install, I was forced to address the issue.

Looking for an error, I found 0x800F081F which lead me to the following commands which need to be run from an elevated command prompt --

dism.exe /online /cleanup-image /scanhealth

dism.exe /online /cleanup-image /restorehealth

Be patient, these appear to stop midstream but eventually it will complete.  After that, re-run Windows Update and it should work as it should.