During a specific project, customer was complying about a simple process using Windows Sysprep which wasn’t working properly, and an error were provided to the customer like this one:
When you face this, I usually recommend during troubleshooting the following steps to diagnose and solve this problem:
Check if Windows was upgraded from Windows 7 to Windows 10
If your operational system has been upgraded from Windwos 7 or other version to Windows 10, you need to check under regedit.exe entrances if this KEY and / or REG_DWORD is configured. In positive way, you need to delete them into the following path: Computer\HKEY_LOCAL_MACHINE\SYSTEM\Setup\Upgrade
After entries have been removed, add the following REG_DWORD into this path as well:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\Setup\Status\SysprepStatus\CleanupState [Set Hexadecimal Value: 7]
After deleting all entries, open a Command Prompt running as Administrator:
Type the following command and restart your Windows 10 machine: slmgr /dli
I strongly recommend a reboot after this command and configurations.
This might solve Windows migration problem that may be causing your Sysprep error. In case this did not solve yours, please check the additional step below:
Remove Windows .Appx Installations from Current User
Sometimes, when you start a Sysprep process, you receive the following message:
If you see the log entries into %WINDIR%\System32\Sysprep\Panther\setupact.log or %WINDIR%\System32\Sysprep\Panther\SetupErr.log, you can see some errors related to:
<Date> <Time>, Error SYSPRP Package <PackageFullName> was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
<Date> <Time>, Error SYSPRP Failed to remove apps for the current user: 0x80073cf2.
<Date> <Time>, Error SYSPRP Exit code of RemoveAllApps thread was 0x3cf2.
This occur because some .appx packages were installed to the current user and Sysprep will not allow you to run it until you remove them properly.
You can try to remove using commands below, like Microsoft KB at this link:
- Remove-AppxProvisionedPackage –PackageName <PackageName>
- Remove-ProvisionedAppxPackage –PackageName <PackageName>
Or, you can do the following:
- Take ownership of C:\ProgramData\Microsoft\Windows\AppRepository
- Give Administrator full access and TrustedInstaller need to have Modify rights
- Change Administrators Access to Full Control
- Stop State Repository service.
- You may stop Windows Installer service as well, Appx Deployment Service and Tile data model server.
Under C:\ProgramData\Microsoft\Windows\AppRepository, you can see lots of file. Select these files. You’ll need to remove them all, ok?
- Start the State Repository service.
As soon the service is started again, those files will be created again.
Sysprep process might be working and you will not see this problem.
Enjoy the ride!