Configuration Manager OSD task sequence fails with error code 80070005

Applies to: System Center Configuration Manager

Symptoms


A System Center Configuration Manager OSD task sequence fails during the Setup Windows and ConfigMgr step when the step still runs in Windows PE.

The following error messages are logged in the X:\windows\temp\smstslog\smsts.log file:

 

Here is the detail information about error code 80070005 (2147942405):

Cause


This issue occurs if a custom SetupComplete.cmd file is specified. OSD task sequences use the SetupComplete.cmd file to continue the task sequence after Windows Setup finishes. If a custom SetupComplete.cmd file is specified, the task sequence can’t install its own SetupComplete.cmd file, and returns the "Access is denied" error. Therefore, custom SetupComplete.cmd files aren't allowed with Configuration Manager OSD task sequences.

A custom SetupComplete.cmd file may be specified in one of the following ways:

  • It’s copied to the appropriate location in a task (usually a Run Command Line task) between the Apply Operating System and Setup Windows and ConfigMgr tasks. The following is an example of the command line in a Run Command Line task:

    cmd.exe /c copy SetupComplete.cmd %OSDTargetSystemDrive%\Windows\Setup\Scripts
     
  • It’s included as part of a custom OS WIM file.

The SetupComplete.cmd file is located in the %WINDIR%\Setup\Scripts folder, in either the offline OS or the OS WIM image.

For more information about the SetupComplete.cmd file, see Add a Custom Script to Windows Setup.

Resolution


To fix this issue, remove the custom SetupComplete.cmd file. In most cases, any actions being taken in the custom SetupComplete.cmd file can instead be moved as tasks in the task sequence.

Depending on how the custom SetupComplete.cmd file is specified, use one of the following methods to remove the file:

  • If it’s specified in a Run Command Line task between the Apply Operating System and Setup Windows and ConfigMgr tasks, remove the Run Command Line task from the task sequence.
  • If it’s part of a custom OS image, add a Run Command Line task between the Apply Operating System and Setup Windows and ConfigMgr tasks. In the command line of the Run Command Line task, enter the following command to delete the custom SetupComplete.cmd file:

    cmd.exe /c del SetupComplete.cmd %OSDTargetSystemDrive%\Windows\Setup\Scripts /F /Q