Bootstrap

Sysprep Error—Package xxxx was installed for a user, but not provisioned for all users.

Sysprep Error information :

Package Microsoft.LanguageExperiencePackzh-CN_19041.3.7.0_neutral__8wekyb3d8bbwe was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.

Solution :

Step1:找到setupact.log 的文件,找出错误日志来源。

Step2:根据来源找到解决办法。

 Failed Way 1:打开Windows power shell ,以管理员运行如下命令。

Remove-AppxProvisionedPackage -Online -PackageName + 需要卸载掉的packagename

但是我运行时,依旧是错误讯息,故放弃了,原版解决方法路径如下,大家试过成功的可以来报喜。Sysprep fails due to an app that was installed for a user, but not provisioned for all users – Azvise

Failed Way2 :打开Windows power shell ,以管理员运行如下命令。

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

但我运行出来的结果是我需要移除的包删不了,所以失败结尾。

Successful Way:

1.打开cmd,以管理员打开运行,运行如下命令,myUser 需要改成自己的账户名。

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 

2.找到下面的XML节点并删除它,保存文件并再次启动sysprep。

<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>

;