Today I was working on my SCCM Task Sequence when an error showed “Command line execution failed (80070002)” and my task sequence failed.
In the smsts.log I saw the following errors.
- CreateProcess failed. Code(0x80070002)
- Command line execution failed (80070002)
- clCommandLine.Execute( uOptions, pszWorkingDir, lpDesktop), HRESULT=80070002 (runcommandline.cpp,465)
- Failed to execute command line
- Install Software failed to run command line, hr=0x80070002
- Failed to run the action: Remove Google Chrome Desktop Shortcut. Error -2147024894
Looking at the logs you can see the task sequence step “Remove Google Chrome Desktop Shortcut” caused the error.
In my task sequence I can see there is a “Run Command Line” step with the command “del “%Public%\Desktop\*.lnk”
How To Fix Command line execution failed (80070002)
To Fix Command line execution failed (80070002) follow these steps
- Log on to the machine that failed and manually run the command line that failed, in my case “del “%Public%\Desktop\*.lnk”
- Confirm the command ran with out errors
- If you did get an error, correct it and update the task sequence step
- Make sure the command line in the task sequence starts with cmd /c
- In my task sequence I updated to cmd /c del “%Public%\Desktop\*.lnk” which resolved the issue
- Click ok to save the task sequence
- Run the task sequence again
Below is what my remove google chrome desktop shortcut looks like after the change