Completely uninstall provisioned apps: how-to and detailed explanation

Page 7 of 7 FirstFirst ... 567

  1. Posts : 36
    Windows 10 Home 19044 64-bit
    Thread Starter
       #61

    ddelo said:
    ... everything has been removed, including the 'C:\Program Files\WindowsApps\Microsoft.YourPhone_*' folder ...
    Hi Dimitri,
    that's actually good news, as it suggests that what we are doing is ok. As I said, it is the first time I see this strange behaviour and the fact you can't reproduce the issue means that the procedure is correct.

    Now, a couple of things. First: when I talk about de-registration, I do not search the entire registry. We know some rubbish will remain and to be honest I never bothered manually cleaning the registry. I prefer some dead keys to a non-booting machine. I only check:
    HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Applications\
    which is the hive from which I get the name of the package I feed to RemoveAppxPackage.

    Second, and more interesting. Two hours after removing the app, the Event Viewer shows an additional log entry stating that the orphaned package is now sheduled for removal. The removal will take place upon login of the user with SID S-1-5-21-bla-bla-bla-1000. Typing:
    Code:
    wmic useraccount get name,sid
    reveals that... that user account is mine! Interesting: I made two clean reboot after uninstalling the app, but clearly the scheduled removal doesn't work because the folder is still sitting there.

    I want to try something else. I'll keep you posted.
    Cheers,
    Mark
      My Computer


  2. Posts : 2,450
    Windows 10 Pro x64
       #62

    Mark0 said:

    Second, and more interesting. Two hours after removing the app, the Event Viewer shows an additional log entry stating that the orphaned package is now sheduled for removal. The removal will take place upon login of the user with SID S-1-5-21-bla-bla-bla-1000. Typing:
    Code:
    wmic useraccount get name,sid
    reveals that... that user account is mine! Interesting: I made two clean reboot after uninstalling the app, but clearly the scheduled removal doesn't work because the folder is still sitting there.

    I want to try something else. I'll keep you posted.
    Cheers,
    Mark
    Good news Mark. After all the uninstall process didn't actually delete the folder but it moved it in the "Deleted" folder.
    So apparently has its own deletion process. Give it a couple of days (and some reboots)!
      My Computer


  3. Posts : 36
    Windows 10 Home 19044 64-bit
    Thread Starter
       #63

    ddelo said:
    Good news Mark. After all the uninstall process didn't actually delete the folder but it moved it in the "Deleted" folder.
    So apparently has its own deletion process. Give it a couple of days (and some reboots)!
    Yes, I noticed that packages are sometimes temporarily moved to the Deleted subfolder, which appears to work as a bin. Sometimes they disappear after a day, sometimes after a couple of weeks. The reason is not clear.

    Back to the Phone package... I still can't explain the reason that led to the anomalous behaviour, but I found a solution. Not super elegant, but it does the job.
    The Event Viewer shows that the orphaned package is scheduled for removal. That is good, because it means the package is not necessary and can be removed with no danger. After all, that package was automatically removed during the test performed by Dimitri.
    So, I want to get rid of the folder, but I religiously avoid to take ownership of things I am not supposed to own. I decide to help the removal: I open an elevated PowerShell session and I just feed the undesired package to Remove-AppxPackage:
    Code:
    Remove-AppxPackage -Package Microsoft.YourPhone_1.22052.136.0_x64__8wekyb3d8bbwe -AllUsers -Confirm
    Folder gone.

    To sum it up: 99% of the times everything goes well. In the rare case a package isn't worked off automatically as it sould, removing it manually with an additional call to Remove-AppxPackage is the easiest and safest way.
    It seems that orphaned packages appear in unpredictable and non reproducible ways. Even though it is possible to automate this additional clean-up step in a script, I won't be up to it soon because such events seem so rare it is not worth the effort. In case something is left behind, one line of code will do the job.

    Cheers,
    Mark
      My Computer


  4. Posts : 2,450
    Windows 10 Pro x64
       #64

    Mark0 said:
    So, I want to get rid of the folder, but I religiously avoid to take ownership of things I am not supposed to own. I decide to help the removal: I open an elevated PowerShell session and I just feed the undesired package to Remove-AppxPackage:
    Code:
    Remove-AppxPackage -Package Microsoft.YourPhone_1.22052.136.0_x64__8wekyb3d8bbwe -AllUsers -Confirm
    Folder gone.

    Hey Mark. Sorry but I didn't get that one.
    Since removing the "Microsoft.YourPhone_1.22052.136.0_x64__8wekyb3d8bbwe" app, everything was deleted but the Program Files folder, which was moved under Deleted, how did the Remove-AppxPackage find it. It does not exist as AppxPackage, just a deleted folder ....

    Unless you hadn't run Get-AppxPackage -Name "Microsoft.YourPhone*" to verify the deletion and it was there as appxpackage but moved for deletion to the Deleted folder
      My Computer


  5. Posts : 36
    Windows 10 Home 19044 64-bit
    Thread Starter
       #65

    ddelo said:
    Hey Mark. Sorry but I didn't get that one.
    Since removing the "Microsoft.YourPhone_1.22052.136.0_x64__8wekyb3d8bbwe" app, everything was deleted but the Program Files folder, which was moved under Deleted, how did the Remove-AppxPackage find it. It does not exist as AppxPackage, just a deleted folder ....

    Unless you hadn't run Get-AppxPackage -Name "Microsoft.YourPhone*" to verify the deletion and it was there as appxpackage but moved for deletion to the Deleted folder
    1 - Errata corrige. For the sake of completeness, I'll rephrase what I said about the Deleted subfolder. All removed app packages are always moved to the Deleted subfolder. This is very clear from the event logs. What I actually meant is that most packages disappear from the Deleted subfolder straight away, so one would not even notice they get moved by looking at the folder content, but only scanning through the logs. Some other packages sit inside Deleted for longer time, sometimes a week or two.

    2 - And now to ddelo's question. YourPhone was installed as a bundle:
    Microsoft.YourPhone_1.22052.136.0_neutral_~_8wekyb3d8bbwe
    Microsoft.YourPhone_1.22052.136.0_x64__8wekyb3d8bbwe
    Microsoft.YourPhone_1.22052.136.0_neutral_split.scale-xxx_8wekyb3d8bbwe
    Microsoft.YourPhone_1.22052.136.0_neutral_split.language-xx_8wekyb3d8bbwe
    I first called Remove-AppxPackage targeting the bundle package: Microsoft.YourPhone_1.22052.136.0_neutral_~_8wekyb3d8bbwe. This is the procedure we understand has to be followed when removing bundle apps.
    3 out of 4 packages were moved to Deleted and then immediately removed. The main package Microsoft.YourPhone_1.22052.136.0_x64__8wekyb3d8bbwe was not moved to Deleted. It remained in its place in WindowsApps.
    In order to delete this orphaned package I called Remove-AppxPackage again, this time targeting the leftover main package.

    Hope this helps!
    Cheers,
    Mark
      My Computer


  6. Posts : 2,450
    Windows 10 Pro x64
       #66

    Mark0 said:
    3 out of 4 packages were moved to Deleted and then immediately removed. The main package Microsoft.YourPhone_1.22052.136.0_x64__8wekyb3d8bbwe was not moved to Deleted. It remained in its place in WindowsApps.
    In order to delete this orphaned package I called Remove-AppxPackage again, this time targeting the leftover main package.
    Ahaaaa.... now you're talking!!!
    Thanks for the clarification!
      My Computer


  7. Posts : 4
    Windows 11
       #67

    How to deal with apps that are being staged by the system account


    ddelo said:
    @wellyj. Glad you found it useful and many thanks for trying it out.

    I have noticed that some apps have two versions installed (that’s what I mean by “Duplicate”).
    One version, the older one, is at state “Staged” whereas the newer version is in state “Installed”. This can happen to both Bundled and non-Bundled Apps. Thus to my opinion the older version can be deleted as it doesn’t offer anything.
    These “Duplicate” apps can be easily found, if you uncomment # where Name -In $OlderStagedApps |, in the $AppsToRemove definition. Once you do that, you just select all the “Staged” apps and you remove them.

    And one final note. I’ve also seen numerous scripts in the net for removing MS apps.
    But with the great observations of OP @Mark0 and the help of the great guru @Brink, I believe, along with @Paul Black and his invaluable suggestions and testing, we have created a concise script that completely removes MS apps, without allowing them to be reinstalled.
    I have two apps that when i try to remove them it acts as if they are being removed but then when you do a Get-Appx they are still showing up and show up as staged and the sid listed there is for "S-1-5-18". Tried using psexec cmd I saw out there also with the -s and -c switches. Apps are the Office Hub and One Note.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 10:15.
Find Us




Windows 10 Forums