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.
Update 2024/04/04: I opened a ticket at microsoft. Public fix should be available by the May, 24 update. The Preview already contains the fix.
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
Thank you Michael!
After searching various TechNet forums and getting nowhere, your code managed to get my image Sysprep’d.
Thank you very much.
just saved me 2-5 hours of removing then one by one.
thanks a lot
Thank you! Worked for me as well.
Thanks, saved me so much time!;)
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.
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.
Hi Amar,
nice hint. See it on other pages too. But have never tried it.
Michael
It worked for me beautifully
@Amar Honnungar XML snipped added
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
Props. After searching ages for a solution this worked absolutely fine.
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.
Thx. Typo fixed
Michael
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
Merci beaucoup, ça fonctionne pour moi aussi.
BRAVO à vous