The latest major Windows update, version 1803 (but this solution applies to other versions too), wouldn’t install on my computer. On the Windows update dialogue window, it constantly said “Requires a restart to finish installing”, even though I’d restarted the computer several times.
I eventually found the solution in the message by dckeks on this forum.
The first scan he suggests came back clean. I then entered the second command and restarted, and I was then able to install the update.
He provides additional instructions in a later post if the first two methods don’t work.