FIX: SysPrep Fatal error: dwRet = 31, Machine is in an invalid state or we couldn't update the recorded state.
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:
HKEY_LOCAL_MACHINE\System\Setup\Status\SysprepStatus
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:
HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\SoftwareProtectionPlatform
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:
msdtc –uninstall
3. Then re-install the MSDTC service by typing the following command (and press Enter).
msdtc –install
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.
BP1768
Jan 11, 2018 @ 02:32:00
Excellent document
Many thanks
Damo
Nov 13, 2017 @ 12:45:01
Worked perfectly for me too, nice one.
Francesco Beccari
Nov 09, 2017 @ 16:15:17
A complete walkthru for solving this problem. Thank you for sharing.
barto
Aug 30, 2017 @ 03:16:20
Anda joya muchas gracias…
lmh0925
Jul 18, 2017 @ 21:26:02
Thank you!! very helpful!
Mikkel Jensen
Jul 14, 2017 @ 15:45:42
Brilliant! Thank you.
Saved me from starting all over with an image.
Shafiq Kamarudin
Jul 06, 2017 @ 17:23:01
I did all the steps up until, "part one fixing boot filenon MBR" (step 1)
I cant find any file that says window in any disk. Does this means my windows really did gone missing?
How do did it happen and how do i fix this?
lakonst
Jul 06, 2017 @ 19:50:57
@Shafiq Kamarudin: I think that you wrote your comment in a wrong article.
Andrew
Jun 06, 2017 @ 17:43:53
Thanks, that did the trick!
Lee
Feb 19, 2017 @ 14:37:43
Thanks, after trying everything this worked for me.
The only extra thing I needed to do after following this tutorial to get it working was to disable windows media player through cmd (admin privs) with the command 'net stop WMPNetworkSvc'.
Kip
Feb 14, 2017 @ 23:03:40
thanks !
Sam
Feb 09, 2017 @ 18:40:30
Sweet fix, thank you
Drew
Jan 26, 2017 @ 03:02:34
Worked for me as well! Thanks!!
Engineering
Nov 15, 2016 @ 18:35:16
Nice, instructions. Got my sysprep running again. Thanks!
Add
Sep 30, 2016 @ 22:21:44
Awesome!! that helped alot.
lynx
Sep 18, 2016 @ 20:20:53
Thank You So Much! This saved me so much time!