On a machine running Windows 8, 8.1, 10 or even Windows Server 2012, 2012R2 or 2016 you can get a strange error when sysprepping the machine.
Sysprep was not able to validate your Windows installation.
Normally this is true because you can’t sysprep an upgraded machine. But I had this in a fresh install.
So the error is telling me to look in C:\Windows\System32\Sysprep\Panther and open the setupact.log file. So I did:
Error [0x0f0036] SYSPRP spopk.dll:: Sysprep will not run on an upgraded OS. You can only run Sysprep on a custom (clean) install version of Windows.
Error [0x0f0082] SYSPRP ActionPlatform::LaunchModule: Failure occurred while executing ‘Sysprep_Clean_Validate_Opk’ from C:\Windows\System32\spopk.dll; dwRet = 0x139f
Error SYSPRP SysprepSession::Validate: Error in validating actions from C:\Windows\System32\Sysprep\ActionFiles\Cleanup.xml; dwRet = 0x139f
Error SYSPRP RunPlatformActions:Failed while validating SysprepSession actions; dwRet = 0x139f
Error [0x0f0070] SYSPRP RunExternalDlls:An error occurred while running registry sysprep DLLs, halting sysprep execution. dwRet = 0x139f
Error [0x0f00d8] SYSPRP WinMain:Hit failure while pre-validate sysprep cleanup internal providers; hr = 0x8007139f
What we see here is that for some reason Windows thinks it has been upgraded.
Ok now we know that, what is the solution?
Actually pretty easy, in the registry!
In the HKEY_LOCAL_MACHINE\SYSTEM\Setup\ node you will
find a REG_DWORD ‘Upgrade‘ with a value of probably 0 (meaning not an upgrade…)
Just delete the ‘Upgrade’ key and you are good to go!
Not even a reboot is required.