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

Remove-AppxPackage -AllUsers error on Windows 10 #131

Open
GuillaumeHullin opened this issue Sep 21, 2024 · 24 comments
Open

Remove-AppxPackage -AllUsers error on Windows 10 #131

GuillaumeHullin opened this issue Sep 21, 2024 · 24 comments
Assignees
Labels
bug Something isn't working

Comments

@GuillaumeHullin
Copy link

Most of the Windows 10 (around 5-6 this week) I tried to run the debloat script failed to uninstall apps with the following error:

Attempting to remove Microsoft.549981C3F5F10...
Remove-AppxPackage : Échec de lappel de procédure distante.
Échec de lappel de procédure distante.
Au caractère C:\Users\FTAdmin\AppData\Local\Temp\Win11Debloat\Win11Debloat-master\Win11Debloat.ps1:374 : 98
+ ... ilter Main, Bundle, Resource -AllUsers | Remove-AppxPackage -AllUsers
+                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Remove-AppxPackage], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.Windows.Appx.PackageManager.Comman
   ds.RemoveAppxPackageCommand

I tried Microsoft updates, sfc, reset Microsoft Store, etc... no luck. Anybody?

@GuillaumeHullin
Copy link
Author

PS C:\WINDOWS\system32> Get-AppxPackage *Print3D* | Remove-AppxPackage -allusers
Remove-AppxPackage : Échec de lappel de procédure distante.
Échec de lappel de procédure distante.
Au caractère Ligne:1 : 29
+ Get-AppxPackage *Print3D* | Remove-AppxPackage -allusers
+                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Remove-AppxPackage], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.Windows.Appx.PackageManager.Comman
   ds.RemoveAppxPackageCommand

@Raphire
Copy link
Owner

Raphire commented Sep 21, 2024

Heya,

This looks similar to the issue that people encountered a while ago #74. It seems to stem from some kind of bug in Remove-AppxPackage that doesn't exist in Windows 11. I did implement a work-around specifically for Windows 10 that seemed to do the job, but maybe something changed?

I'll see if I can reproduce this issue myself and report back.

@Raphire Raphire self-assigned this Sep 21, 2024
@Raphire Raphire added the bug Something isn't working label Sep 21, 2024
@GuillaumeHullin
Copy link
Author

There are two more data I can give you:
1- it only happens with systems which are have been used... I tried on a fresh windows 10, it works.
2- I have an other Windows 10 where the Microsoft store package seems to be broken... and the script work fine there.

@GuillaumeHullin
Copy link
Author

I found an Windows 10 22H2 with build 19045.4651... and there it works.
All the other failing are build 19045.4894.
So I'm guessing the problem is the latest upgrade... maybe reinstalling some components would help?

@Raphire
Copy link
Owner

Raphire commented Sep 24, 2024

Thanks again for the additional info, I have some trouble updating my w10 vm's, once I get them up to date I'll test and look for a solution.

@Raphire
Copy link
Owner

Raphire commented Sep 25, 2024

@GuillaumeHullin After updating my VM's I am now on 19045.4957. Uninstalling apps seems to work as expected. Could you see if updating your machines fixes the issue?

@GuillaumeHullin
Copy link
Author

I only have access right now to one Win10 but I don't have update available and I'm still at 19045.4894, how did you update?

@Raphire
Copy link
Owner

Raphire commented Sep 26, 2024

I only have access right now to one Win10 but I don't have update available and I'm still at 19045.4894, how did you update?

It seems to be a relatively new release, maybe it's a gradual roll-out. https://support.microsoft.com/en-us/topic/september-24-2024-kb5043131-os-build-19045-4957-preview-2d4a5c54-ac58-4bdb-8685-57d578650e5f

@GuillaumeHullin
Copy link
Author

Back on that problem, I got some Windows 10 with the build 19045.4894 and which had the same problem before and it still persists avec the update... any idea?

@Raphire
Copy link
Owner

Raphire commented Sep 30, 2024

Back on that problem, I got some Windows 10 with the build 19045.4894 and which had the same problem before and it still persists avec the update... any idea?

I have been able to reproduce it now on 19045.4894 aswell. It seems to be related to multiple users. Windows 10 seems to have this issue, while Windows 11 doesn't. There seem to be some other reports about this issue on the internet, but no clear reason or solution.

The only workaround that I have found to work is removing the -AllUsers flag from the command. This does however mean the script only uninstalls app for the current user.

@GuillaumeHullin
Copy link
Author

But the weird thing is that I have other Windows 10 updated to the same build, and I have no issue running the script. I was thinking maybe comparing some DLLs or other related files that could indicate a difference between the systems but so far I couldn't find anything.

@Raphire
Copy link
Owner

Raphire commented Sep 30, 2024

But the weird thing is that I have other Windows 10 updated to the same build, and I have no issue running the script. I was thinking maybe comparing some DLLs or other related files that could indicate a difference between the systems but so far I couldn't find anything.

Do those machines have multiple users?

@GuillaumeHullin
Copy link
Author

All of them. At least 2 admin accounts and one users.
None of the admin accounts are linked to a Microsoft account.
Some users are. No relations there.
Some machines are part of a domain. No relations there either.

@Raphire
Copy link
Owner

Raphire commented Sep 30, 2024

All of them. At least 2 admin accounts and one users. None of the admin accounts are linked to a Microsoft account. Some users are. No relations there. Some machines are part of a domain. No relations there either.

Interesting, thanks for sharing these observations. Are all these machines on Windows 10?

@GuillaumeHullin
Copy link
Author

Yes, all Windows 10. On Windows 11 machines, it works fine.

@Raphire
Copy link
Owner

Raphire commented Oct 1, 2024

Yes, all Windows 10. On Windows 11 machines, it works fine.

Just to confirm: Are all Windows 10 machines affected, or do some Windows 10 machines work ok?

From what I can tell so far it seems to be related to Windows 10.

@GuillaumeHullin
Copy link
Author

Some Windows 10 machines works okay. I would say 50/50.

Raphire added a commit that referenced this issue Oct 1, 2024
Additionally added a workaround for the issue described in #131, to ensure the app is atleast uninstalled for the current user while we figure out how to fix app removal for all users.
@Raphire
Copy link
Owner

Raphire commented Oct 1, 2024

@GuillaumeHullin Very weird indeed. I haven't found any solution for the issue so far, I'll update this thread when I do.

I did find out that app removal only seems bugged when using the -AllUsers switch. So I pushed an update that includes a sort of workaround to ensure the apps are atleast uninstalled for the current user.

@GuillaumeHullin
Copy link
Author

Some log from my Windows 10 problems.
I tried a few different recently and no issues... until this one.

Attempting to remove Clipchamp.Clipchamp...
Unable to remove *Clipchamp.Clipchamp* for all users
   à System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   à Microsoft.Windows.Appx.PackageManager.Commands.RemoveAppxPackageCommand.RemovePackageForAllUsers(String packageFullName, Boolean& encounteredErrors)
   à Microsoft.Windows.Appx.PackageManager.Commands.RemoveAppxPackageCommand.ProcessRecord()
   à System.Management.Automation.CommandProcessor.ProcessRecord()
Attempting to remove Microsoft.3DBuilder...

@GuillaumeHullin
Copy link
Author

I did find out that app removal only seems bugged when using the -AllUsers switch. So I pushed an update that includes a sort of workaround to ensure the apps are atleast uninstalled for the current user.

Yes, I did see that too. Does your script log when uninstalling without the AllUsers switch?

@Raphire
Copy link
Owner

Raphire commented Oct 10, 2024

I did find out that app removal only seems bugged when using the -AllUsers switch. So I pushed an update that includes a sort of workaround to ensure the apps are atleast uninstalled for the current user.

Yes, I did see that too. Does your script log when uninstalling without the AllUsers switch?

It does log an error if the uninstall fails for the current user. Looking at the output you shared the uninstall did work for the current user.

@GuillaumeHullin
Copy link
Author

I did find out that app removal only seems bugged when using the -AllUsers switch. So I pushed an update that includes a sort of workaround to ensure the apps are atleast uninstalled for the current user.

Yes, I did see that too. Does your script log when uninstalling without the AllUsers switch?

It does log an error if the uninstall fails for the current user. Looking at the output you shared the uninstall did work for the current user.

Where do you see that it did work for the current user 😅 ?

@Raphire
Copy link
Owner

Raphire commented Oct 11, 2024

If removal fails for the current user it would show Unable to remove *Clipchamp.Clipchamp* for current user

Admittedly though the current implementation isn't the clearest.

@GuillaumeHullin
Copy link
Author

Oh okay. Good to know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants