When trying to sysprep and windows 10 (1709) build I get the following error:
Package Windows.MiracastView_6.3.0.0_neutral_cw5n1h2txyewy was installed for a
user but not provisioned for all users. This package will not function
properly in the sysprep image.
I tried using powershell to remove it but the error message says it is part of windows and cannot be removed.
I checked the user accounts and I only have one user account (other accounts are built-in windows accounts).
How can I get sysprep to work?
After further investigation I found that miracast view is the only app where Get-AppxPackage -allusers has the pending status:
Name : Windows.MiracastView
Publisher : CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : Neutral
ResourceId : neutral
Version : 6.3.0.0
PackageFullName :Windows.MiracastView_6.3.0.0_neutral_neutral_cw5n1h2txyewy
InstallLocation :
IsFramework : False
PackageFamilyName : Windows.MiracastView_cw5n1h2txyewy
PublisherId : cw5n1h2txyewy
PackageUserInformation : {S-1-5-21-4120236872-3763413694-1479318824-1000 [Operator]: Installed(pending removal)}
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
IsPartiallyStaged : False
SignatureKind : System
Status : Ok
Okay, here is what I found and it was probably due to a lack of understanding how imaging works that caused the issue in the first place although it was only after the 1709 october release did we see the issue.
So we have VMs where we create the images. When we did the 1709 update we had left the reference image on network which downloaded some additional updates for some windows store apps. Each time we sysprep'd we kept getting failures. Removing the apps with powershell only highlighted other apps that needed to be removed. These were staged app entries and can be found as:
Get-AppXPackage -AllUser | % {if ($_.PackageUserInformation.InstallState -eq "Staged"){$_.PackageFullname}}
So, I left the reference image on the network and waited until all the staged entries disappeared (this took about 30 minutes). Rerunning the script above will not show any staged apps.
Once this was done, sysprep worked.
I think in the past, staged apps did not cause sysprep to fail but now it does.
Note that you'll see a wsappx process that runs which updates all the staged apps (view in Task manager).