On a machine running Windows 8, 8.1, 10 or even Windows Server 2012, 2012R2 or 2016 you can get error when sysprepping the machine.
Sysprep was not able to validate your Windows installation. (Error 0x8007139f)
So, look in C:\Windows\System32\Sysprep\Panther and open the “setupact.log” file:
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.
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…)