Completely uninstall provisioned apps: how-to and detailed explanation

Page 6 of 7 FirstFirst ... 4567 LastLast

  1. Posts : 10
    Windows 11
       #51

    ddelo said:
    Sorry for the necro Dimitri but I seem to be having trouble running your script on 21H2.
    Here's the error I'm getting:
    Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named 'op_Addition'.
    At C:\Users\test\Desktop\Uninstall-App.ps1:20 char:1
    + $SelectedApps = ($Apps_All + $Apps_Bundle) | sort Name | Out-GridView ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (op_Addition:String) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound


    No Apps selected for removal.

    This is on a freshly installed VM.
      My Computer


  2. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #52

    Hello @wellyj,

    Can you post the PS Script that you are using as I can NOT find the ERROR reference in the original code.

    I had previously run it as you have seen.

    Did you include any adjustments that were added after the code was posted?
      My Computer


  3. Posts : 10
    Windows 11
       #53

    Hey Paul!
    The only adjustments I've done to the original script were to uncomment the 3 commented out portions and remove the -WhatIfs.

    Have you tried running the script on the latest Windows 10 build?

    I suspect this is something new that was introduced in the more recent builds, as I've just found out I can run this without issues on the 2019 LTSC release.
      My Computer


  4. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #54

    Hello @wellyj,

    wellyj said:
    Have you tried running the script on the latest Windows 10 build?
    NO I haven't.

    wellyj said:
    I suspect this is something new that was introduced in the more recent builds, as I've just found out I can run this without issues on the 2019 LTSC release.
    Maybe Dimitri will be able to shed some light on it when he sees your post.
      My Computer


  5. Posts : 10
    Windows 11
       #55

    I was able to fix this by enforcing that Apps_All is an array by wrapping it in @():

    Code:
    $Apps_All  = @(Get-AppxPackage -AllUsers | where SignatureKind -ne 'System' | select Name, PackageFullName, SignatureKind, Architecture)
    It seems like Powershell wasn't reading it as an array (but as an automation object instead), so it was struggling to concatenate it with Apps_Bundle.
      My Computer


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

    Hello @wellyj & @Paul Black

    I really didn't try the version in this thread so I can't verify wellyj's solution. What I can confirm though is that Apps_All is a system Array!!!

    Anyway, I apologize for not following up the solution provided in this thread with the PowerShell script presented before, but I have been working on that solution for quite some time now.
    The script has evolved since then and here is Version 2.0 of it.

    Remove-Apps2.ps1

    Lot's of changes have been made, so I would recommend reading the notes part (in the beginning) of the script.
    The convention we started with removal is still on. i.e. someone has to edit the script and uncomment the removal commands, for removing apps.

    Although extensive testing has been done on Windows versions W10 20H1 up to W11 21H1, I would recommend to run the script in a VM, after creating a snapshot or to a physical machine after having created a system image, so you can rollback.

    One last thing, for users who just want to remove duplicate apps.
    In the $AppsToRemove definition, the user must uncomment # where Name -In $OlderStagedApps |. You can uncomment that and save it as Remove-DuplicateApps.ps1, to have a second version for only duplicate apps. (it can be done in a more efficient way, but I haven't found the time to do it...)
    Last edited by ddelo; 18 Jul 2022 at 07:00.
      My Computer


  7. Posts : 10
    Windows 11
       #57

    Wow feels like Christmas
    I can confirm the script runs smoothly!

    I really think this should somehow have more visibility.
    Just removing preinstalled apps using PS is nothing new, but nowhere else do I see a discussion of bundle vs non-bundle or duplicate apps.
    I also like your approach of making sure nothing vital gets removed.
    This avoids so many potential stability and usability issues in the future.

    Question regarding the 1st (and maybe 3rd?) entry in changelog:
    I didn't even realize having multiple versions of an app was possible, but if so, what does the fix constitute?
    Does it list all the versions instead of just listing the app once, so it's up to the user to select which (if not all) versions to remove?
      My Computer


  8. Posts : 2,450
    Windows 10 Pro x64
       #58

    @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.
    Last edited by ddelo; 18 Jul 2022 at 15:23.
      My Computer


  9. Posts : 36
    Windows 10 Home 19044 64-bit
    Thread Starter
       #59

    Hello,
    it has been long time since my last post.
    First of all, I have to congrat with Dimitri for the impressive work. Well done, really!
    I'm posting two updates on the topic.

    1 - Goog news first. In the couple of years I've been using this procedure to remove dozens of apps from different systems. I performed the first tests on Windows 10.0.19041. Several feature updates later, I'm now on 10.0.19044 and none of the removed apps ever came back.

    2 - And now bad (?) news. For the first time, yesterday I noticed something weird. Let me first say that I uninstall one app at the time and after every removal I verify that nothing is left behind. I always check:
    - de-staging: Get-AppxPackage shall return nothing after Remove-AppxPackage is executed;
    - de-provisioning: Get-AppxProvisionedPackage shall return nothing;
    - app remnants: the app folders should disappear from Program Files\WindowsApps and from all the user profiles;
    - de-registration: app references should be removed from the registry.
    In addition I always check the event logs to see if something anomalous shows up.
    So far so good. Yesterday I removed for the first time the Phone app: Microsoft.YourPhone_1.22052.136.0. As it often happens, this app is distributed as a bundle of four packages: the main package, the language package, the split-scale package and finally the bundle wrapper.
    Remove-AppxPackage works as usual and completes with no error. The app does get de-staged, de-provisioned and de-registered, and all the app folders are removed. All, except the main package in Program Files\WindowsApps. Three of of four packages are deleted, but the main package Microsoft.YourPhone_1.22052.136.0_x64__... is still there.
    Also, no errors are recorded in the logs: the Event Viewer only shows information-level entries. There is an anomalous entry though:
    Code:
     Moving folder \\?\C:\Program Files\WindowsApps\Microsoft.YourPhone_1.22052.136.0_x64__8wekyb3d8bbwe to \\?\C:\Program Files\WindowsApps\Deleted\Microsoft.YourPhone_1.22052.136.0_x64__8wekyb3d8bbwe3e67b0fc-79a5-4ff5-9180-e43cb20cd8e6. Result: 0x80070020.
    The exit code is normally 0x0.
    Still trying to figure out the reason for this strange behaviour. It never happened before. Also, the absence of errors in PowerShell and in the logs puzzles me. At the moment I can only guess. The main package may be need by other apps to work properly, but I am not aware of any method to easily retrieve the app dependence tree in Windows. I'll work on it and I will post back in case I find an explanation.

    Cheers,
    Mark
      My Computer


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

    Mark0 said:
    Hello,

    Remove-AppxPackage works as usual and completes with no error. The app does get de-staged, de-provisioned and de-registered, and all the app folders are removed. All, except the main package in Program Files\WindowsApps. Three of of four packages are deleted, but the main package Microsoft.YourPhone_1.22052.136.0_x64__... is still there.
    Hi Mark, glad to hear from you, after quite some time. I hope you're doing well.

    I'm afraid I cannot verify your claim about, Your Phone app (now called Phone Link).
    I used the script, and deleted the app and everything has been removed, including the 'C:\Program Files\WindowsApps\Microsoft.YourPhone_*' folder.
    The only things left, after deletion, were some Registry entries for the app (130 of them), both from the deleted version and from some older versions of it.

    I would like to hear your findings, whenever you get something.
    Last edited by ddelo; 30 Aug 2022 at 06:02.
      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 11:47.
Find Us




Windows 10 Forums