Windows 10 fails to sysprep with the error message: “A fatal error occurred while trying to sysprep the machine.”

Problem

You attempt to run sysprep on a Windows 10 operating system by manually navigating to C:windowssystem32sysprep to execute the sysprep.exe:

… but receive the following error:

System Preparation Tool 3.14


A fatal error occurred while trying to sysprep the machine.

You navigate to the directory:

C:windowssystem32sysprepPanther

.. and find the following the content in the setuperr.log file:

2019-03-14 07:29:46, Error [0x0f0073] SYSPRP RunExternalDlls:Not running DLLs; either the machine is in an invalid state or we couldn’t update the recorded state, dwRet = 0x1f

2019-03-14 07:29:46, Error [0x0f00ae] SYSPRP WinMain:Hit failure while processing sysprep cleanup external providers; hr = 0x8007001f

Solution

One of the first items to check is that the rearm limit has not been reached by executing slmgr.vbs /dlv to review the Remaining Windows rearm count (the desktop I was working on has not reached 0):

If the Remaining Windows rearm count hasn’t been exceeded then proceed to check the following registry keys:

HKEY_LOCAL_MACHINESYSTEMSetupStatusSysprepStatus

Verify that the CleanupState registry key is set to 2:

Verify that the GeneralizationState is set to 7 (the desktop I was working on had the value of 3):

Uninstall and reinstall the MSDTC with the following commands:

msdtc -uninstall

msdtc –install

Navigate to the following registry key:

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionSoftwareProtectionPlatform

Verify that the SkipRearm key has the value of 1:

Rerunning the sysprep.exe executable to start the sysprep process should work as expected now:

8 Responses

  1. Hey man, was scouring the internet for a while for a fix for this, since I was trying to build an image with some other applications in it and this saved me from rebuilding it. Thank you!

  2. Hi, I tried everything you posted and I still receiving the error. I'm trying to Sysprep Windows version 21H1. The last version I was able to Sysprep was 1909. Any help would be appreciated.

    Thanks

  3. Hello
    Same problem: I tried everything you posted and I still receiving the error. I'm trying to Sysprep Windows version 21H1…

  4. Ok, I guess 21H1 does Sysprep…but only on a clean install. What sucks is the amount of time it will take to rebuild the current image on a clean install.

  5. I finally succeeded on W10 21h1 !

    First: https://docs.microsoft.com/en-us/answers/questions/515817/windows-10-sysprep-error-a-fatal-error-occurred-wh.html

    Then I execute the script:

    "@ECHO OFF
    reg add "HKLMSYSTEMSetupStatusSysprepstatus" /v CleanupState /t REG_DWORD /d 00000002 /F
    reg add "HKLMSYSTEMSetupStatusSysprepstatus" /v GeneralizationState /t REG_DWORD /d 00000007 /F
    reg add "HKLMSOFTWAREMicrosoftWindows NTCurrentVersionSoftwareProtectionPlatform" /v SkipRearm /t REG_DWORD /d 00000001
    msdtc -uninstall
    timeout 120
    msdtc -install
    timeout 120
    rmdir /Q /S "C:WindowsSystem32SysprepPanther"
    del /Q "C:WindowsSystem32SysprepSysprep_succeeded.tag"

    Finally I reboot -> sysprep OK.