Creating a Windows 8 or Windows 8.1 reference image, using Microsoft Deployment Tool or System Center Configuration Manger, manually using sysprep or during Prepare OS (sysprep task sequence step) fails.
When running sysprep manually within Windows you will see this error box:
Running sysprep through Microsoft Deployment Tool or System Center Configuration Manager you will see the following error entries in SetupErr.log:
<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.
Sysprep has an additional provider that is added in Windows 8 / 8.1 to clean Appx packages and generalise the image. The provider will only work if the Appx package is a per-user package or an all-user provisioned package.
Per-user package means that the Appx package is installed for a particular user account and is not available for the other users of the machine.
All-user package means that the Appx has been provisioned into the image so that all users who use this image will get the App.
If an All-user package provisioned into the image was un-provisioned manually from the image, but not removed for a particular user, then during sysprep, the provider will run into an error cleaning out this package. The provider will also fail, if an All-user package provisioned into the image was updated by one of the users on the reference machine.
Additional information: When a Windows 8 / 8.1 machine has been online for 60 minutes it automatically starts to download (stage) Appx packages and updates. This is useful because, when a user manually updates the app through the Windows Store app, the update files are already on the machine and don’t have to be downloaded. Some of these packages might install Per-user and not per All-users. This practically means that if you capture the reference machine within 60 minutes you will be able to successfully sysprep the machine.
IMPORTANT: Remove all provisioned Per-user Appx packages before running sysprep on the reference machine. Otherwise you might have to start all over building your reference image from scratch.
Before starting the sysprep procedure make sure to remove all additional users (except administrator) logged onto the computer, along with their associated files.
Deleting all staged Appx packages:
Run the command: “Get-AppxProvisionedPackage -online | Remove-AppxProvisionedPackage -online” at the PowerShell prompt. This will list all default installed Appx packages (which are installed per user) AND since it is piped to Remote-AppxProvisionedPackage, it will remove them all.
Note: You will get RED errors – this is expected due to dependencies.
Deleting specific staged Appx packages:
To get a list of the provisioned packages, run the following command:
“Get-AppXProvisionedPackage -online | select PackageName”
To remove a particular provisioned app, run the following command:
“Remove-AppXProvisionedPackage -Online -PackageName <PackageName>”
Now, capture your reference image and enjoy your Windows 8 / 8.1 deployment.