Windows 10 Sysprep error - A fatal error occurred while trying to sysprep the machine

MacXpert2025 16 Reputation points
2021-08-16T16:04:00.237+00:00

Documenting this workaround for anyone else facing this issue.

123643-2021-08-16-11-23-43-sysprep-failing-windows-10-pro.png

Kept running into this error when attempting sysprep Windows 10 20H2 machine. Tried the solution mentioned here which didn't work https://social.technet.microsoft.com/Forums/en-US/67249445-5678-4739-93e1-82e9ce61834c/sysprep-failing-windows-10-pro-x86?forum=win10itprosetup

2021-08-12 11:29:30, Info SYSPRP ActionPlatform::LaunchModule: Executing method 'Sysprep_Generalize_MountPointManager' from C:\Windows\System32\spmpm.dll
2021-08-12 11:29:30, Info Sysprep_Generalize_MountPointManager ENTER
2021-08-12 11:29:30, Error Sysprep_Generalize_MountPointManager: RegDeleteKey failed with error=2
2021-08-12 11:29:30, Info Sysprep_Generalize_MountPointManager LEAVE
2021-08-12 11:29:30, Error SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing 'Sysprep_Generalize_MountPointManager' from C:\Windows\System32\spmpm.dll; dwRet = 0x2
2021-08-12 11:29:30, Error SYSPRP SysprepSession::ExecuteAction: Failed during sysprepModule operation; dwRet = 0x2
2021-08-12 11:29:30, Error SYSPRP SysprepSession::ExecuteInternal: Error in executing action for Microsoft-Windows-Sysprep-MountPointManager; dwRet = 0x2
2021-08-12 11:29:30, Error SYSPRP SysprepSession::Execute: Error in executing actions from C:\Windows\System32\Sysprep\ActionFiles\Generalize.xml; dwRet = 0x2
2021-08-12 11:29:30, Info SYSPRP SysprepSession::Execute: Sysprep mode was not specified, deleting it from registry
2021-08-12 11:29:30, Error SYSPRP RunPlatformActions:Failed while executing Sysprep session actions; dwRet = 0x2
2021-08-12 11:29:30, Error [0x0f0070] SYSPRP RunDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x2
2021-08-12 11:29:30, Error [0x0f00a8] SYSPRP WinMain:Hit failure while processing sysprep generalize internal providers; hr = 0x80070002

Workaround solution:

1) Take ownership of file C:\Windows\System32\Sysprep\ActionFiles\Generalize.xml. Default owner is System Installer, change to Administrators
2) Change permissions to grant Users+Administrators Modify permission on the file
3) Edit the file and search for line referencing the DLL file SPMPM.DLL and remove that line (around line 22) remove the entire line including <imaging></imaging>

i.e. remove this line
<imaging exclude=""><assemblyIdentity name="Microsoft-Windows-Sysprep-MountPointManager" version="10.0.19041.1" publicKeyToken="31bf3856ad364e35" processorArchitecture="amd64" versionScope="NonSxS"></assemblyIdentity>
<sysprepOrder order="0x0800"></sysprepOrder>
<sysprepModule methodName="Sysprep_Generalize_MountPointManager" moduleName="$(runtime.system32)\spmpm.dll"></sysprepModule></imaging>

4) Save the file and run Sysprep

This allows Sysprep to skip that problematic line, I'm not sure if this breaks anything with the Sysprep process but I was finally able to complete the sysprep generalize and didn't notice any issues. If anyone has clues as to why this happens please share your thoughts?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,806 questions
Windows 10 Setup
Windows 10 Setup
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
1,912 questions
{count} votes