I figured it out by myself. I will add some key prompts to make others easy to search.
The setupact.log file will show something like this:
Error SYSPRP Package Microsoft.Internal.Media.PlayReadyClient_2.3.1678.1_x64__8wekyb3d8bbwe was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
And When you want to delete windows 8 apps through PowerShell, It will says that apps are installed by an unknown user, which sid is S-1-5-21-XXXX
. And when you execute Remove-AppxPackage
in powershell, it will says
Because the current user does not have that package installed
As far as i know, Remove-AppxPackage can only remove apps belong to the user which you log in. I don't know why there is an unknown user in my OS, but here is my solution.
- Delete all files in
C:\Program Files\WindowsApps
(You need to change ownership and permission of this folder by right click on it)
- Delete all files in
C:\ProgramData\Microsoft\Windows\AppRepository
(You need change the ownership too).
Now when you Get-AppxPackage -allusers
, it will shows nothing. Now you can run sysprep.exe and it will work well (Remember to change HKLM\SYSTEM\Setup\Status\Sysprep\SysprepStatus to 7).
1The AppRepository folder is under C:\ProgramData, not Program Files. Other than that, this has been genius! – None – 2015-06-11T21:28:58.940