Task Sequence failed with the error code (0×80070002)
You have a task sequence that includes running USMT and you realise it fails at the Capture User Files and Settings task. The error code that was thrown is (0×80070002).
Further looking into the smsts.log file showed a couple of warnings and errors.
Failed to delete registry value HKLM\Software\Microsoft\SMS\Task Sequence\System Health Agent. Error code 0×80070002
Error executing Task Sequence Manager service. Code 0×80004005
Guess what the solution for me was? My site servers were running on SP2 and from I know all of my agents should also be running at that version. However, the computer where this problem happened when checked, had a pre-SP2 client version. A quick update of the agent, and a simple collection query for all pre-SP2 client version and I’m very quickly back up to speed with my agent to at least SP2 version. Running the task sequence again and it just went like a breeze. Hope that helped some of you.