Windows: sysprep fails with “Failure occurred while executing ‘Sysprep_Clean_Opk’ “

Hi,

after an Upgrade from Windows 10 to Windows 11 on a customer PC sysprep is no longer working. Unfortunataly the error messages in C:\Windows\System32\sysprep\Panther\setuperr.log does not really help to find the root cause:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Error                        pGetUninstallInterfaceCommon: Failed loading the setupplatform, hr = 0x80070666
Error                 SYSPRP RemoveUninstall:Failed to instantiate uninstall interface; hr = 0x80070666
Error                 SYSPRP Sysprep_Clean_Opk:Failed to remove Uninstall; dwRet = 0x666
Error                 SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing 'Sysprep_Clean_Opk' from C:\Windows\System32\spopk.dll; dwRet = 0x666
Error                 SYSPRP SysprepSession::ExecuteAction: Failed during sysprepModule operation; dwRet = 0x666
Error                 SYSPRP SysprepSession::ExecuteInternal: Error in executing action for Microsoft-Windows-Sysprep-SpOpk; dwRet = 0x666
Error                 SYSPRP SysprepSession::Execute: Error in executing actions from C:\Windows\System32\Sysprep\ActionFiles\Cleanup.xml; dwRet = 0x666
Error                 SYSPRP RunPlatformActions:Failed while executing Sysprep session actions; dwRet = 0x666
Error      [0x0f0070] SYSPRP RunDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x666
Error      [0x0f00a8] SYSPRP WinMain:Hit failure while processing sysprep cleanup providers; hr = 0x80070666
Error      [0x0f0060] SYSPRP ParseCommands:Found unsupported command line option '/?'
Error      [0x0f00a4] SYSPRP WinMain: Unable to parse command-line arguments to sysprep; GLE = 0x0
Error      [0x0f0060] SYSPRP ParseCommands:Found unsupported command line option '/?'
Error      [0x0f00a4] SYSPRP WinMain: Unable to parse command-line arguments to sysprep; GLE = 0x0

After some investigation I found out that there are still parts from the old Windows version:

1
2
3
4
5
D:\> dir C:\
02.06.2025  16:05    <DIR>          Windows
02.06.2025  16:05    <DIR>          Windows.old
               3 Datei(en),          8.308 Bytes
              10 Verzeichnis(se), 57.714.802.688 Bytes frei

After cleaning up => start cleanmgr.exe with administrator permissions

Solve sysprep error with Cleanmgr
Solve sysprep error with Cleanmgr

sysprep runs as expected 🙂

Michael