Sysprep in Windows 10 – How to Remove and Unprovision Built-In Windows 10 Appx Apps

May 6, 2018 | MDT, Powershell

Issue: Sysprep Fails To Generalize an Image on Windows 10

The Cause: Windows 10 has a number of built-in Appx apps, such as the Microsoft Office Hub, Tips, the Feedback Hub, Duolingo, XBox and others.

When preparing a base image for an enterprise, you may decide that you want to remove these apps to cut down on the size of your image. However, if these apps are unprovisioned from Windows profiles, but still installed on a user’s account, Sysprep’s validation mechanism can fail.

Symptoms:

  • You remove some of these Windows 10 apps from your image
  • You run Sysprep, and it throws an error.
  • The Sysprep log shows something akin to:

Package (name) was installed for a user, but not provisioned for all users. This app will not function properly in the sysprep image.

Resolution:

  • Built-In apps must be both uninstalled and unprovisioned for all user profiles on the base image.
  • A PowerShell script can be run to make this process much easier.

Thanks to Shawn over at Virtually Inclined for having a comprehensive explanation of the issue and links to a script that worked for the issue I had with this.

Run This Script to Address the Issue

Copy and Paste from the source: http://virtuallyinclined.com/2018/02/10/windows-10-appx-removal-script-update/

Explanation: Uninstalling Vs Unprovisioning Built-In Windows 10 Apps

Windows 10 keeps a manifest of all of the built-in apps that it will install on every new user profile on your image. The apps on that manifest are provisioned on your image, and then installed separately for every user.

To get rid of these apps, they must be uninstalled from every user account, and then unprovisioned so they’re off the manifest — after that, those apps won’t be installed for any future new user accounts.

Powershell has a handy way of doing this using the Get-AppxPackage (to uninstall) and Get-AppxProvisionedPackage (provisioning) cmdlets.

Pitfalls to Avoid

  • The PowerShell cmdlets that remove these apps will only run on the current user’s account. This means if you created 2 user accounts on your image, you need to login and run the script on both user accounts separately.
  • Do not delete any extra user accounts until you have removed the desired Appx apps from them. Failure to do this might result in the manifest in breaking Sysprep completely, as Windows may yell at you to remove the app from a user account you can no longer access.