Sysprep fails after you remove or update Windows Store apps that include built-in Windows images

Summary

This article discusses an issue that occurs when you remove or update a provisioned Windows Store app by using the Windows Store and then running sysprep on the computer.

Sysprep is a tool for IT administrators who want to prepare an installation of Windows for duplication, auditing, and customer delivery. The guidance in this article is intended for use by support agents and IT professionals. If you are a home user who is encountering issues while using Windows Store apps, see the following Windows websites:

Introduction

Several Windows Store apps include built-in Windows 10 and Windows 8 images. These include the Mail, Maps, Messaging, Bing, Travel, and News apps, among others. These are known as provisioned apps. Provisioned apps are staged in the image and are scheduled to be installed for every user of the Windows image at first logon. In addition to the built-in apps, you can side-load your own line of business Windows Store apps into the Windows image without having to publish them to the Windows Store. You can side-load Appx packages by using online or offline servicing commands that are available in DISM.exe or through the DISM PowerShell module.

Symptoms

Consider the following scenarios:

Scenario 1

You are creating a custom Windows 10 or Windows 8 reference computer that you want to sysprep and capture.

You want to remove some of the provisioned Windows Store apps (Appx packages) from this reference computer.

You run dism -online /Remove-ProvisionedAppxPackage /PackageName:<packagename> to deprovision the Appx packages.

When you run sysprep operation in this scenario, the operation may fail with the following error:

System Preparation Tool 3.14A fatal error occurred while trying to sysprep the machine

Scenario 2

You have an existing Windows image, and several Windows Store apps are side-loaded in the image.

You want to remove some of the side-loaded Appx packages from your image and customize it further.

You boot into the reference computer and run one of the following PowerShell commands to remove the provisioning of the Appx package:

Remove-AppxProvisionedPackage –PackageName <PackageName>

Remove-ProvisionedAppxPackage –PackageName <PackageName>

When you run sysprep operation in this scenario, the operation may fail with the following error:

System Preparation Tool 3.14A fatal error occurred while trying to sysprep the machine

Scenario 3

You are creating a Windows 10 or Windows 8 reference image.

You connect to the Windows 10 or Windows 8 Store, and then you update the built-in Windows Store apps by using the Windows Store.

When you run sysprep operation in this scenario, the operation may fail with the following error:

System Preparation tool 3.14A fatal error occurred while trying to sysprep the machine

Additionally, in the SetupErr.log, you may notice the following error entries:

Cause

Sysprep has an additional provider that's added in Windows 10 and Windows 8 to clean Appx packages and to generalize the image. The provider works only 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 other users of the computer.

All-user package means that the Appx has been provisioned into the image so that all users who use this image can access the app.

If an all-user package that's provisioned into the image was manually deprovisioned from the image but not removed for a particular user, the provider will encounter an error while cleaning out this package during sysprep. The provider will also fail if an all-user package that's provisioned into the image was updated by one of the users on this reference computer.

Resolution

To resolve this issue, remove the package for the user who's running sysprep, and also remove the provisioning. To do this, follow these steps.

Note To prevent Windows Store from updating apps, unplug the Internet connection or disable Automatic Updates in Audit mode before you create the image.

In the output of this last cmdlet, check the users for whom the package is showing up as Installed. Delete these user accounts from the reference computer, or log on to the computer by using these user accounts. Then, run the cmdlet in step 4 to remove the Appx package.

This command lists all packages that were published by Microsoft and installed by any user of that reference computer. Because the computer is to be sysprepped, we assume that these user profiles no longer require the package.

If you have manually provisioned apps that belong to other publishers, run the following command to list them: