ConfigMgr 2007: OSD fails with "Sysprep did not complete successfully" error when capturing a Windows Vista or newer image

Here's a great tip from Frank Rojas, a real life support engineer from Charlotte, North Carolina. If you currently work with Vista or newer images or are planning to in the future you'll definitely want to take a look at this one.

========

Issue: When trying to capture a Windows Vista or newer (e.g. Windows 7, Windows 2008, Windows 2008 R2, etc) image via SCCM 2007 OSD, the capture fails. Looking at the SMSTS.log, the following error messages are displayed:

Sysprep did not complete successfully
RunSysprep(sCmdLine, bActivate, m_bDebug), HRESULT=80004005 (e:\nts_sms_fre\sms\client\osdeployment\prepareos\prepareos.cpp,1326)
Unable to sysprep the machine, hr=80004005
pCmd->Sysprep(bActivate, bMsd), HRESULT=80004005
(e:\nts_sms_fre\sms\client\osdeployment\prepareos\main.cpp,270)
Sysprep'ing the machine failed, hr=80004005
De-Initialization successful
Exiting with error code 16389
Process completed with exit code 16389
!--------------------------------------------------------------------------------------------!
Failed to run the action: Prepare Operating System.
Unknown error (Error: 00004005; Source: Unknown)
The execution of the group (Capture the Reference Machine) has failed and the execution has been aborted. An action failed.
Operation aborted (Error: 80004004; Source: Windows)
Failed to run the last action: Prepare Operating System. Execution of task sequence failed.
Unknown error (Error: 00004005; Source: Unknown)
Sending status message . . .
Do not send status message in full media case
Execution::enExecutionFail != m_eExecutionResult, HRESULT=80004005
(e:\nts_sms_fre\sms\client\tasksequence\tsmanager\tsmanager.cpp,762)
Task Sequence Engine failed! Code: enExecutionFail
****************************************************************************
Task sequence execution failed with error code 80004005

If you look at the setupact.log or the setuperr.log on the PC trying being captured (located in C:\Windows\System32\Sysprep\Panther) you may also see the following error messages:

Error [0x0f0073] SYSPRP RunExternalDlls:Not running DLLs; either the machine is in an invalid state or we couldn't update the recorded state, dwRet = 31
Error [0x0f00a8] SYSPRP WinMain:Hit failure while processing sysprep cleanup providers; hr = 0x8007001f

Cause: These errors may be caused by trying to Sysprep a Windows Vista image more than three times, which Windows Vista does not allow. Please refer to KB929828: An error message occurs when you run "Sysprep /generalize" in Windows Vista: "A fatal error occurred while trying to Sysprep the machine"

Resolution: There are two possible solutions or workarounds to this problem:

  1. Use the above described method in building the Windows Vista image from scratch each time by using a task sequence. Anytime you need to make changes to the image, change the task sequence and allow the image to be built from scratch again. This is the preferred method.
  2. Rebuild the Windows Vista image manually from scratch. Since anytime you want to make changes to the image you will need to manually rebuild the image from scratch again, method 1 is prefered since it automates the image building process.  Note: The image could be manually captured without Syspreping using a utility such as ImageX so that changes can be done to the reference image in the future. However this image should never be deployed to other PCs. It should only be used to make modifications to the original reference image BEFORE being Syspreped.

More Information: Usually this issue occurs when updating existing images by dropping an existing image down, making changes to the image, and then Syspreping it again. Each time the image is Syspreped, it counts as one of the three allowed Syspreps in Windows Vista. Keep in mind that if you are trying to modify an OEM image, the OEM manufacturer has probably already Syspreped the image once, so this Sysprep will count towards one of the three Syspreps allowed by Windows Vista.

The preferred method of updating images in SCCM 2007 OSD is by using a task sequence to always build an image from scratch. If any changes need to be done to the image, the appropriate changes are added to the task sequence, and the image is rebuilt from scratch. This resolves the problem because once the image is created, the Sysprep count is always at one.

This information applies to System Center Configuration Manager 2007.

========

Thanks Frank!

J.C. Hornbeck | Manageability Knowledge Engineer

Note: This article was updated on 02/18/2010 to add references to OSs nerwer than Windows Vista and to remove a previously incorrect or incomplete resolution.