How To Fix Command line execution failed (80070002)

Jason Barrett Jason Barrett | | Task Sequence

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

Command line execution failed (80070002)

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

google chrome task sequence step


How To Fix Command line execution failed (80070002)

To Fix Command line execution failed (80070002) follow these steps

  1. Log on to the machine that failed and manually run the command line that failed, in my case “del “%Public%\Desktop\*.lnk”
  2. Confirm the command ran with out errors
  3. If you did get an error, correct it and update the task sequence step
  4. Make sure the command line in the task sequence starts with cmd /c
  5. In my task sequence I updated to cmd /c del “%Public%\Desktop\*.lnk” which resolved the issue
  6. Click ok to save the task sequence
  7. Run the task sequence again

Below is what my remove google chrome desktop shortcut looks like after the change

sccm task sequence