I have faced a strange error when trying to run SysPrep on the installed system, which is going to be used to create a reference image to deploy Windows 10 using System Center Configuration Manager 2012 R2. After starting SysPrep, the following error appears:
Let’s open the Sysprep log file setupact.log and analyze the errors.
The error evidently reports that SysPrep cannot be run on the systems upgraded from previous Windows versions. It is just our case: the system has been upgraded from Windows 7 to Windows 10 Indeed, according to the article in KB828287 knowledge base: Microsoft does not support the use of Sysprep to create images of an installation that has been upgraded (SP installation is not considered to be an upgrade). SysPrep is only supported in clean installations. Whether you have to reinstall the system from scratch?
I managed to find an simple solution. Using Process Monitor with the filter by process sysprep.exe and having compared a clean and upgraded versions of Windows 10, I could get the list of register keys checked by SysPrep when being started that allow to determine whether the system is clean or upgraded. Here is what you have to do to delete the mark of the upgraded system for Windows 10 checked by SysPrep (it also works in other Windows versions):
- Open the Registry Editor (regedit.exe)
- Go to HKEY_LOCAL_MACHINE\SYSTEM\Setup\
- Delete the Upgrade key (if exist) and the registry value with the name Upgrade
- In HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus key specify the CleanupState value equal to 7
- Restart your computer and try to run SysPrep again
You can do it by deleting all user profiles (if applicable), completely uninstalling all Metro applications for all users (not recommended) or by uninstalling such applications manually. The last option can be done like that:
- Get the list of all installed Metro applications in all user profiles (we need only packages with the Installed status):
Get-AppxPackage -AllUser | Format-List -Property PackageFullName,PackageUserInformation
- And uninstall them one by one as follows:
Remove-AppxPackage -Package <packagefullname>. Or like this:
Remove-AppxProvisionedPackage -Online -PackageName <packagefullname>