{"id":7390,"date":"2021-01-13T22:24:19","date_gmt":"2021-01-13T21:24:19","guid":{"rendered":"https:\/\/michlstechblog.info\/blog\/?p=7390"},"modified":"2024-04-04T13:08:48","modified_gmt":"2024-04-04T11:08:48","slug":"windows-sysprep-fails-with-package-xy-installed-for-a-user-but-not-provisioned-for-all-users","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/windows-sysprep-fails-with-package-xy-installed-for-a-user-but-not-provisioned-for-all-users\/","title":{"rendered":"Windows: Sysprep fails with  &#8220;Package xy installed for a user, but not provisioned for all users&#8221;"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_7390 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_7390')){$('.twoclick_social_bookmarks_post_7390').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"Windows%3A%20Sysprep%20fails%20with%20%20%26%238220%3BPackage%20xy%20installed%20for%20a%20user%2C%20but%20not%20provisioned%20for%20all%20users%26%238221%3B\",\"the_excerpt\":\"Hi%2C%0D%0A%0D%0Awhen%20you%20call%20sysprep%20and%20it%20fails%20%28logfile%20C%3A%5Cwindows%5CSystem32%5Csysprep%5Cpanther%5Csetuperr.log%29%20with%20an%20error%20%22Package%20xy%20installed%20for%20a%20user%2C%20but%20not%20provisioned%20for%20all%20users%22%20you%20have%20to%20remove%20those%20packages%20from%20the%20user%20profile.%0D%0A%0D%0A%20%28more%26hellip%3B%29\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/windows-sysprep-fails-with-package-xy-installed-for-a-user-but-not-provisioned-for-all-users\\\/\",\"post_id\":7390,\"post_title_referrer_track\":\"Windows%3A+Sysprep+fails+with++%26%238220%3BPackage+xy+installed+for+a+user%2C+but+not+provisioned+for+all+users%26%238221%3B\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hi,<\/p>\n<p>when you call sysprep and it fails (logfile C:\\windows\\System32\\sysprep\\panther\\setuperr.log) with an error <strong>&#8220;Package xy installed for a user, but not provisioned for all users&#8221;<\/strong> you have to remove those packages from the user profile.<\/p>\n<p><!--more--><br \/>\n<!-- https:\/\/docs.microsoft.com\/en-US\/troubleshoot\/windows-client\/deployment\/sysprep-fails-remove-or-update-store-apps --><br \/>\nRoot cause is that the user has installed those package(s) but they are not provisioned for all users.<\/p>\n<p><strong>Update 2024\/04\/04: I opened a ticket at microsoft. Public fix should be available by the May, 24 update. The <a href=\"https:\/\/support.microsoft.com\/en-us\/topic\/march-26-2024-kb5035941-os-build-19045-4239-preview-a170797c-503e-4372-b3b6-89f290b4f2cb\" rel=\"noopener\" target=\"_blank\">Preview<\/a> already contains the fix. <\/strong><\/p>\n<p>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..<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nPS D:\\&gt; $aProvPackages=@(Get-AppxProvisionedPackage -Online).PackageName\r\nPS D:\\&gt; Get-AppxPackage -AllUsers | ?{ -not ($aProvPackages -contains $_.PackageFullName ) } | %{write-host $_;Remove-AppxPackage -AllUsers -Package $_}\r\n<\/pre>\n<p>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&#8230;.<br \/>\nStart 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.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nD:\\&gt; cd \/d C:\\Windows\\system32\\sysprep\r\nC:\\Windows\\system32\\sysprep\\Actionfiles&gt; takeown \/F Generalize.xml\r\nC:\\Windows\\system32\\sysprep\\Actionfiles&gt; icacls Generalize.xml \/grant myUser:(m)\r\nC:\\Windows\\system32\\sysprep\\Actionfiles&gt; notepad Generalize.xml \r\n<\/pre>\n<p>Locate the follwing XML node and remove it, save the file and start sysprep again.<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;imaging exclude=&quot;&quot;&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;assemblyIdentity name=&quot;Microsoft-Windows-AppX-Sysprep&quot; version=&quot;10.0.19041.1566&quot; publicKeyToken=&quot;31bf3856ad364e35&quot; processorArchitecture=&quot;amd64&quot; versionScope=&quot;NonSxS&quot;\/&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;sysprepOrder order=&quot;0x1A00&quot;\/&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;sysprepValidate methodName=&quot;SysprepGeneralizeValidate&quot; moduleName=&quot;$(runtime.system32)\\AppxSysprep.dll&quot;\/&gt;\r\n\u00a0\u00a0\u00a0\u00a0&lt;sysprepModule methodName=&quot;SysprepGeneralize&quot; moduleName=&quot;$(runtime.system32)\\AppxSysprep.dll&quot;\/&gt;\r\n&lt;\/imaging&gt;\r\n<\/pre>\n<p>Michael<\/p>\n<p><!--\n\n2021-02-02 07:27:02, Error                 SYSPRP Package Microsoft.PPIProjection_10.0.15063.0_neutral_neutral_cw5n1h2txyewy was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.\n2021-02-02 07:27:02, Error                 SYSPRP Failed to remove apps for the current user: 0x80073cf2.\n2021-02-02 07:27:02, Error                 SYSPRP Exit code of RemoveAllApps thread was 0x3cf2.\n2021-02-02 07:27:02, Error                 SYSPRP ActionPlatform::LaunchModule: Failure occurred while executin\n\n1. Try : \n\n\nGet-AppxPackage -Alluser | ?{$_.InstallLocation -eq $null} | Remove-AppxPackage -AllUsers\nGet-AppxPackage -Allusers|?{$_.Installlocation -eq $null}|%{Remove-AppPackage -AllUsers $_}\n\nDelete the Profile of the user you has the appx installed\n\n\n\/\/ C:\\Windows\\System32\\Sysprep\\sysprep.exe \/oobe \/generalize \/unattend:C:\\sysprep\\sysprep.xml \/reboot\n\n\n2. Try (not working, shorttest)\nhttps:\/\/social.technet.microsoft.com\/Forums\/windows\/en-US\/a05cb12a-e0f7-4330-86ae-abca1ffb5629\/ltsc-2019-sysprp-failed-to-remove-apps-for-the-current-user-0x80073cf2?forum=win10itprogeneral\n\nWindows Registry Editor Version 5.00\n\n[HKEY_LOCAL_MACHINE\\SYSTEM\\Setup]\n\"Upgrade\"=-\n\"UninstallActive\"=dword:00000000\n\"UninstallMark\"=-\n\"UninstallGUID\"=-\n\"UninstallSourceVersion\"=-\n\"UninstallScenario\"=-\n\n3. Try (not tried yyet)\n\nOr Python script\n\nhttps:\/\/www.winhelponline.com\/blog\/error-0x80073cfa-uninstall-app-removal-failed\/\n\nOr with DB Browse\nhttps:\/\/blog.sreb.me\/2018\/11\/28\/force-remove-uwp-app\/\n\nget full package Name\n\nDelete all about the package under\nC:\\ProgramData\\Microsoft\\Windows\\AppRepository\\\nC:\\ProgramData\\Microsoft\\Windows\\AppRepository\\Packages\\\n\nand any refs in \nC:\\ProgramData\\Microsoft\\Windows\\AppxProvisioning.xml\n\nopen DB Browser for SQLite as Administrator\nBackup file\n\nC:\\ProgramData\\Microsoft\\Windows\\AppRepository\\StateRepository-Deployment.srd\n\nand open it in DB Browser\n\n\n\nSQLite:\n\nC:\\ProgramData\\Microsoft\\Windows\\AppRepository\\StateRepository-Machine.srd\n\n\n        Make a working copy of \u201cC:\\ProgramData\\Microsoft\\Windows\\AppRepository\\StateRepository-Machine.srd\u201d\n        Make a backup copy of \u201cC:\\ProgramData\\Microsoft\\Windows\\AppRepository\\StateRepository-Machine.srd\u201d\n        Open it with \u201cDB Browser for SQLite x64\u201d (https:\/\/nightlies.sqlitebrowser.org\/win64\/)\n        Browse the \u201cPackages\u201d table and delete the row mentioning \u201cContactSupport\u201d\n        Take ownership of C:\\ProgramData\\Microsoft\\Windows\\AppRepository\u201d (ignore the errors about failed ownership changes for files inside)\n        Run \u2018tasklist \/svc \/fi \"services eq StateRepository\"\u2019 and write down the PID of the staterepository service\n        Kill the state repository service by running \u2018taskkill \/pid <pid from step d> \/f\u2019\n        Take ownership of \u201cC:\\ProgramData\\Microsoft\\Windows\\AppRepository\\StateRepository-Machine.srd\u201d\n        Replace \u201cC:\\ProgramData\\Microsoft\\Windows\\AppRepository\\StateRepository-Machine.srd\u201d with the copied srd file you modified.\n\n            If you get a warning that the file is in use, then the state repository service probably started again!  Repeat steps f-g and i (skip h) quickly!\n        If you run get-appxpackage \u2013online you should get a bunch of apps, but none of them should say *ContactSupport*\n\ncopy C:\\ProgramData\\Microsoft\\Windows\\AppRepository\\StateRepository-Machine.srd %temp%\\StateRepository-Machine.srd\n\n\n\"C:\\Program Files\\Tools\\sqlite\\sqlite3.exe\" %temp%\\StateRepository-Machine.srd\n\n\n-- Dump database to get the CreateTriggerstatement\n.output c:\/tmp\/appx.sql\n.dump\n.quit\n\n-- Delete Trigger, delete Package, recreate trigger\n\nDROP TRIGGER \"main\".\"TRG_BEFOREDELETE_Package_SRJournal\";\ndelete from Package where  PackageFullName='Microsoft.Windows.ModalSharePickerHost_1000.15063.0.0_neutral_neutral_cw5n1h2txyewy';\nCREATE TRIGGER TRG_BEFOREDELETE_Package_SRJournal BEFORE DELETE ON Package FOR EACH ROW BEGIN UPDATE Sequence SET LastValue=LastValue+1 WHERE Id=2 ;INSERT INTO SRJournal(_Revision, _WorkId, ObjectType, Action, ObjectId, PackageIdentity, WhenOccurred, SequenceId)SELECT 1, workid(), 1, 3, OLD._PackageID, pi._PackageIdentityID, now(), s.LastValue FROM Sequence AS s CROSS JOIN PackageIdentity AS pi WHERE s.Id=2 AND pi.PackageFullName=OLD.PackageFullName;END;\n\nhttps:\/\/github.com\/SoftSonic83\/AppxDBEditor\n--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, when you call sysprep and it fails (logfile C:\\windows\\System32\\sysprep\\panther\\setuperr.log) with an error &#8220;Package xy installed for a user, but not provisioned for all users&#8221; you have to remove those packages from the user profile.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[1518,1516,1517,128,20],"class_list":["post-7390","post","type-post","status-publish","format-standard","hentry","category-windowsknowhow","tag-but-not-provisioned-for-all-users","tag-fails","tag-package-installed-for-a-user","tag-sysprep","tag-windows-2"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/7390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=7390"}],"version-history":[{"count":23,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/7390\/revisions"}],"predecessor-version":[{"id":7392,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/7390\/revisions\/7392"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=7390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=7390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=7390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}