Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sysprep-fails-remove-or-update-store-apps.md #1491

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,33 @@ If you try to recover from an update issue, you can reprovision the app after yo
> [!NOTE]
> The issue does not occur if you are servicing an offline image. In that scenario, the provisioning is automatically cleared for all users. This includes the user who runs the command.

## Automated resolution example to avoid manual steps

sysprep.cmd content example:

mkdir %Systemdrive%\temp
%Systemdrive%\Windows\System32\sysprep\sysprep.exe /oobe /generalize /shutdown /quiet /unattend:%Systemdrive%\temp\unattend.xml
:retry
powershell.exe -ExecutionPolicy Unrestricted -File %Systemdrive%\temp\removeappxpackages.ps1
%Systemdrive%\Windows\System32\sysprep\sysprep.exe /oobe /generalize /shutdown /quiet /unattend:%Systemdrive%\temp\unattend.xml
goto retry

removeappxpackages.ps1 content example:

$sysprepLogPath = "$env:SystemRoot\System32\Sysprep\Panther\setupact.log"
$failedPackages = Get-Content $sysprepLogPath | Select-String -Pattern "Error.*was installed for a user" | ForEach-Object {
if ($_ -match 'Microsoft.*8wekyb3d8bbwe') {
$matches[0]
}
}

foreach ($package in $failedPackages) {
Write-Host "Removing appx package: $package"
Remove-AppxPackage $package -Erroraction 'silentlycontinue'
}



## More information

For more information about how to add and remove apps, see:
Expand Down