Windows Update error 0x80070006

I have had this issue on my work PC and found that errors reporting an invalid handle can arise from Windows Update running in its own process.

You can try checking if Windows Update is running in its own process, and if it is, set it to share and reboot.

To check if it is in its own process, you can run sc query wuauserv in an elevated command prompt, and check what TYPE is reported. For example, one that is is set to run as its own process will look like this:

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>sc query wuauserv

SERVICE_NAME: wuauserv
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

To set it to shared (as it should be), run sc config wuauserv type= share, then reboot your PC (reboot is necessary because of some issue with SIDs not being correct without bringing down the shared process).

Once done, Windows Update should be working (provided there is nothing else wrong with it) and running sc query wuauserv should return a TYPE of 20 WIN32_SHARE_PROCESS.