Today I used sysprep.exe to rebuild my windows image. But it always said "a fatal error occurred while trying sysprep".
Then I went to check setupact.log file , it shows like this
I followed this instructions in Microsoft KB article , but when i execute Get-AppxPackage -AllUser
in powershell, it shows plenty of apps installed by an unknown user like this
I can't delete them by Remove-AppxPackage
. So is there any solution to remove these apps? or just delete this unknown user once and for all?
Best Answer
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:
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 executeRemove-AppxPackage
in powershell, it will saysAs 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.
C:\Program Files\WindowsApps
(You need to change ownership and permission of this folder by right click on it)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).