Windows: Sysprep fails with “Package xy installed for a user, but not provisioned for all users”

Hi,

when you call sysprep and it fails (logfile C:\windows\System32\sysprep\panther\setuperr.log) with an error “Package xy installed for a user, but not provisioned for all users” you have to remove those packages from the user profile.



Root cause is that the user has installed those package(s) but they are not provisioned for all users.

To solve this get a list of all provisioned appx apackages and remove the packages for all users which are not provisioned. Error can ignored..

PS D:\> $aProvPackages=@(Get-AppxProvisionedPackage -Online).PackageName
PS D:\> Get-AppxPackage -AllUsers | ?{ -not ($aProvPackages -contains $_.PackageFullName ) } | %{write-host $_;Remove-AppxPackage -AllUsers -Package $_}

If this does not help. There is another way (THx to Amar Honnungar). This excludes the Appx part from sysprep, but not sure if this has impacts on further updates, etc….
Start a cmd shell with administrator permissions. And jump to the folder C:\Windows\system32\sysprep\Actionfiles and get write permissions on the file Generalize.xml and open it for edit.

D:\> cd /d C:\Windows\system32\sysprep
C:\Windows\system32\sysprep\Actionfiles> takeown /F Generalize.xml
C:\Windows\system32\sysprep\Actionfiles> icacls Generalize.xml /grant myUser:(m)
C:\Windows\system32\sysprep\Actionfiles> notepad Generalize.xml 

Locate the follwing XML node and remove it, save the file and start sysprep again.

<imaging exclude="">
    <assemblyIdentity name="Microsoft-Windows-AppX-Sysprep" version="10.0.19041.1566" publicKeyToken="31bf3856ad364e35" processorArchitecture="amd64" versionScope="NonSxS"/>
    <sysprepOrder order="0x1A00"/>
    <sysprepValidate methodName="SysprepGeneralizeValidate" moduleName="$(runtime.system32)\AppxSysprep.dll"/>
    <sysprepModule methodName="SysprepGeneralize" moduleName="$(runtime.system32)\AppxSysprep.dll"/>
</imaging>

Michael

Advertisment to support michlstechblog.info

14 thoughts on “Windows: Sysprep fails with “Package xy installed for a user, but not provisioned for all users””

  1. Thank you Michael!
    After searching various TechNet forums and getting nowhere, your code managed to get my image Sysprep’d.

  2. 1.Navigate to C:\windows\system32\ and search for the sysprep folder, go to properties change the ownership of the folder to to the local admin by changing the permissions in Advance menu.

    2. After you take the ownership of the folder you can open sysprep\actionfiles and edit the Generalize.xml and remove the following entry from there.

    	<imaging exclude="">
    		<assemblyIdentity name="Microsoft-Windows-AppX-Sysprep" version="10.0.19041.1566" publicKeyToken="31bf3856ad364e35" processorArchitecture="amd64" versionScope="NonSxS"/>
    		<sysprepOrder order="0x1A00"/>
    		<sysprepValidate methodName="SysprepGeneralizeValidate" moduleName="$(runtime.system32)\AppxSysprep.dll"/>
    		<sysprepModule methodName="SysprepGeneralize" moduleName="$(runtime.system32)\AppxSysprep.dll"/>
    	</imaging>
    

    3. Save as the Generalize.xml on any desired location and then rename the existing Generalize.xml to old and replace it with the new one.

    4. Run sysprep Generalize and see if that works for you.

  3. Thank you! Great post

    I didn’t really worked for me, but it served to enlighten some other causes

    What did work for me was creating a new user (admin) and removing all the others (I only had one). Then, after restarting the PC, sysprep worked as a charm

  4. you messed up command 3
    should not be >icacls Generalize.xml /grant:myUser:(m)
    should be >icacls Generalize.xml /grant myUser:(m)

    of course “myUser” should be your actual user name.

  5. Thanks Michael & Amar !!!!!

    Once I rename the existing Generalize.xml to old and replace it with the new one.
    Then the sysprep won’t face error anymore!!!

    Only the little problem is the permission of Generalize.xml.
    I use the force way -> Using WinPE then access in to my System C:\ directly swap the Generalize.xml.
    Won’t face any permission denied

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.