FIX: SysPrep Fatal error: dwRet = 31, Machine is in an invalid state or we couldn't update the recorded state.
Last updated on July 12th, 2017
If you try to run Sysprep on Windows, more than three (3) times, then you will receive the following error message "A fatal error occurred while trying to Sysprep the machine" and the following explanation message is displayed inside the sysprep error log file (setuperr.log): "Date Time, 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".
Microsoft says that this error message "is designed to prevent the deployment of a corrupted image", but this is not true, because the error was caused when you reached the three rearm limit (you cannot run sysprep more than three times on the same machine).
In this tutorial you will find detailed instructions on how you can Sysprep your Windows 7, 8 or 10 machine more than three times and bypass the "Date Time, 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" fatal error while running Sysprep.
How to fix SysPrep Fatal error "dwRet = 31" and Sysprep your machine more than three (3) times.
Step 1. Modify SysprepStatus, CleanupState & SkipRearm Registry Values
1. Open Windows Registry Editor. To do that:
2. Inside Windows Registry, navigate (from the left pane) to this key:
3a. At the right pane change the CleanupState value to 2 and click OK.
3b. Change the GeneralizationState value to 7 and click OK.
4. At the left pane navigate to the following key:
5. At the right pane, change the SkipRearm value to 1.
6. Close Registry Editor.
Step 2. Uninstall and then re-install the MDSTC service (Microsoft Distributed Transaction Coordinator)
1. Open command prompt with Administrative privileges. To do that:
In Windows 7 & Vista go to:
- Start > All Programs > Accessories
- Right-click to “Command prompt” item and choose “Run as administrator”.
In Windows 10, 8 & 8.1:
- Right-click at the screen's bottom-left corner (Start menu) and from the pop-up menu, choose “Command Prompt (Admin)”.
2. In command prompt window type the following command and press Enter to uninstall the MSDTC service:
3. Then re-install the MSDTC service by typing the following command (and press Enter).
4. Close command prompt.
Step 3. Delete the Panther folder.
1. Open Windows Explorer and navigate to C:\Windows\System32\sysprep\ folder.
2. Delete (or Rename) the Panther folder.
3. Now run sysprep again. Sysprep should run now without any problems.
You 're done! Let me know if this guide has helped you by leaving your comment about your experience. Please like and share this guide to help others.