Windows: Removing Appx failed with 0x80070032: This app is part of Windows and cannot be uninstalled on a per-user basis.

Hi,

since the latest Edge updates an Appx Package Microsoft.MicrosoftEdge is installed on a “per user basis”.

This breaks sysprep because it recognizes Edge as installed on a per user basis but not provisioned

2024-01-31 08:41:20, Error SYSPRP Package Microsoft.MicrosoftEdge_44.19041.3570.0_neutral__8wekyb3d8bbwe was installed for a user, but not provisioned for all users. This package will not function properly in the sysprep image.
2024-01-31 08:41:20, Error SYSPRP Failed to remove apps for the current user: 0x80073cf2.
2024-01-31 08:41:20, Error SYSPRP Exit code of RemoveAllApps thread was 0x3cf2.

Update 2024/04/04: I opened a ticket at microsoft. Public fix should be available by the May, 24 update. The Preview already contains the fix.

Trying to remove the package manually throws an error that no one can remove the app because it’s part of windows

PS D:\>  Get-Appxpackage Microsoft.MicrosoftEdge -AllUsers | Remove-Appxpackage -AllUsers
Remove-Appxpackage : The request is not supported.
error 0x80070032: AppX Deployment Remove operation on package Microsoft.MicrosoftEdge_44.19041.3570.0_neutral__8wekyb3d8bbwe from: C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe failed. This app
is part of Windows and cannot be uninstalled on a per-user basis. An administrator can attempt to remove the app from the computer using Turn Windows Features on or off. However, it may not be possible to
uninstall the app.
At line:1 char:53

But there is a workround for such appx :-): Set the appx package to end of life.

For each user who has the appx installed create the following registry key:


HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\EndOfLife\%SID%\%PackageFullName%

For example


reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\EndOfLife\S-1-5-21-2345312345-1023765351-00996621435-1002\Microsoft.MicrosoftEdge_44.19041.3570.0_neutral__8wekyb3d8bbwe

This snipped checks for which user is which version installed and adds the EndOfLife keys:

$aAppxToRemove="Microsoft.MicrosoftEdge"

$aAllAppxPackage=Get-AppxPackage -Allusers $aAppxToRemove

foreach($Appx in $aAllAppxPackage)
{
	
  $aSIDs=($Appx | Select-Object -ExpandProperty PackageUserInformation).UserSecurityId.Sid
  foreach($sSID in $aSIDs)
  {
    New-Item ("HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\EndOfLife\{0}" -f  $sSID)
    New-Item ("HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\EndOfLife\{0}\{1}" -f  $sSID,$Appx.PackageFullName)   
  }
}

Then try to remove the package

PS D:\> Get-AppxPackage -AllUsers Microsoft.MicrosoftEdge | Remove-AppxPackage -Allusers

Michael

Advertisment to support michlstechblog.info

0 thoughts on “Windows: Removing Appx failed with 0x80070032: This app is part of Windows and cannot be uninstalled on a per-user basis.”

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.