Completely uninstall provisioned apps: how-to and detailed explanation

Page 5 of 7 FirstFirst ... 34567 LastLast

  1. Posts : 2,450
    Windows 10 Pro x64
       #41

    Paul Black said:
    Hello @ddelo,


    You are VERY welcome.

    Are the un-installation of the Apps for the Current User, ALL Users, New Users, and will they get installed again when there is a Feature Update for example?
    Not yet for different Users... we need to verify that we can wipe out everything from everybody and then be more specific...I think!

    As for the re-installation....hmmm not entirely sure! I believe they won't come back as of v1909, because MS added the deprovisioned registry entry for online images. But again I just said it, it's MS, you never know!
    This needs to be tested in an older version installation, remove the apps and then let it upgrade to 2004/20H2.
    Unfortunately, I've been up to my ears at work and I haven't been able to test it in a VM...
      My Computer


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

    Hello @ddelo,

    ddelo said:
    Unfortunately, I've been up to my ears at work and I haven't been able to test it in a VM...

    No problems, it is impressive as it is at the moment.

    Just a quick question please, because I don't want to sidetrack this thread in any way.

    Would the following work [ I JUST want Microsoft.WindowsCalculator & Microsoft.WindowsStore remaining ] to remove the Apps from the Current User, ALL Users, New Users, and Feature Updates?

    Code:
    
    Get-AppxPackage -AllUsers | where-object {$_.name -notlike "*Microsoft.WindowsStore*"} | where-object {$_.name -notlike "*Microsoft.WindowsCalculator*"} | Remove-AppxPackage -ErrorAction SilentlyContinue
    Code:
    
    Get-AppxProvisionedPackage -online | where-object {$_.packagename -notlike "*Microsoft.WindowsStore*"} | where-object {$_.packagename -notlike "*Microsoft.WindowsCalculator*"} | Remove-AppxProvisionedPackage -online -ErrorAction SilentlyContinue

    Thanks.
      My Computer


  3. Posts : 2,450
    Windows 10 Pro x64
       #43

    Paul Black said:
    Hello @ddelo,




    No problems, it is impressive as it is at the moment.

    Just a quick question please, because I don't want to sidetrack this thread in any way.

    Would the following work [ I JUST want Microsoft.WindowsCalculator & Microsoft.WindowsStore remaining ] to remove the Apps from the Current User, ALL Users, New Users, and Feature Updates?

    Code:
    
    Get-AppxPackage -AllUsers | where-object {$_.name -notlike "*Microsoft.WindowsStore*"} | where-object {$_.name -notlike "*Microsoft.WindowsCalculator*"} | Remove-AppxPackage -ErrorAction SilentlyContinue
    Code:
    
    Get-AppxProvisionedPackage -online | where-object {$_.packagename -notlike "*Microsoft.WindowsStore*"} | where-object {$_.packagename -notlike "*Microsoft.WindowsCalculator*"} | Remove-AppxProvisionedPackage -online -ErrorAction SilentlyContinue

    Thanks.
    No, it won't!
    This one should work though:

    Code:
    Get-AppxPackage -AllUsers | where-object {$_.name -notmatch "WindowsStore|WindowsCalculator"} | Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue

    But, you've also got the option to run the latest script (the one that removes apps - the one without # and WhatIf) and select all other apps except from the two you want.
      My Computer


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

    Hello @ddelo,

    ddelo said:
    This one should work though:

    Code:
    Get-AppxPackage -AllUsers | where-object {$_.name -notmatch "WindowsStore|WindowsCalculator"} | Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue
    But, you've also got the option to run the latest script (the one that removes apps - the one without # and WhatIf) and select all other apps except from the two you want.

    So is the Second one OK, if not what would it be please?

    Anyway, back to your Script [ I will probably use that anyway ]. I also just wanted to let you know that once I removed an App it did NOT show in the list when I ran the Script again, which is correct.

    I am quite happy to do some testing for you, time permitting of course.
      My Computer


  5. Posts : 2,450
    Windows 10 Pro x64
       #45

    Paul Black said:
    Hello @ddelo,




    So is the Second one OK, if not what would it be please?

    Anyway, back to your Script [ I will probably use that anyway ]. I also just wanted to let you know that once I removed an App it did NOT show in the list when I ran the Script again, which is correct.

    I am quite happy to do some testing for you, time permitting of course.

    The second one should be:

    Code:
    Get-AppxProvisionedPackage -online | where-object {$_.packagename -notmatch "WindowsStore|WindowsCalculator"} | Remove-AppxProvisionedPackage -online -ErrorAction SilentlyContinue
      My Computer


  6. Posts : 18,034
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #46

    Thanks @ddelo,

    I forgot to mention that your Script also managed to remove Microsoft.Advertising.Xaml, which I could NOT previously remove using the Remove-AppxPackage.

      My Computer


  7. Posts : 2,450
    Windows 10 Pro x64
       #47

    Paul Black said:
    Thanks @ddelo,

    I forgot to mention that your Script also managed to remove Microsoft.Advertising.Xaml, which I could NOT previously remove using the Remove-AppxPackage.


    We're getting better Paul.
    Glad it helped you.

    We still, do need to test and verify, if they're reinstalled upon a FU.

    And if OK, we need to make it better, so Shawn @Brink, can use it in the tutorial!...
      My Computer


  8. Posts : 36
    Windows 10 Home 19044 64-bit
    Thread Starter
       #48

    Hello again,
    I see you guys reply quickly! Not sure I can keep pace.
    Anyway, I'll try to reply a bit at a time.


    ddelo said:
    Great question, I don't yet have an answer. Needs more investigation. But, would it make any difference if we know beforehand?
    If for Instance we select the PS script for removal, it will take care of it, without the user getting into the trouble to know!
    No difference for the end user, you're absolutely right. Just curious at which point Remove-AppxPackage calls Remove-AppxProvisionedPackage and how come sometimes the call is not made. I like to know how things work - and sometimes don't work.


    ddelo said:
    Answer: I've come to this conclusion, rather assumption, by firstly deprovisioning from everybody on the machine (i.e. All New users don't ever get it back) and then let the current user (Administrator) to remove from and take care of its own account.
    I see what you mean, but I disagree. I'll briefly explain my reasons.
    Deprovisioning ensures that the app won't be installed when a new user is created. Or, to be more specific, the installation actually takes place upon the first log in of the new user.
    The difference is subtle, but important: a new user who never logs in doesn't get the app installed. I can see that on my machine, where I have a standard user account I use for daily activities and an administrator account with which I never logged in and which I invoke from the standard user account to run elevated tasks. The admin account does not have any app installed.
    Deprovisioning is also useful on a machine shared by many people, where it could be undesirable that certain apps are pushed to the end users which will be created over time.
    The important thing is that deprovisioning does not affect existing accounts, be standard or administrator accounts. Remove-AppxPackage is the one that works on existing accounts. Existing accounts and future accounts are independent and the cmdlets to handle them are also independent.
    This is why the order in which Remove-AppxPackage and Remove-AppxProvisionedPackage are given does not matter. Not saying your script is wrong, just that the final result is the same. To be extra-pedantic, there is one tiny difference. If you run Remove-AppPackage first and the app is of type1 (auto-deprovisioning), the following Remove-AppxProvisionedPackage cmdlet would fail because the app is already deprovisioned.


    ddelo said:
    I haven't found any problem removing any of the 3 types of apps (Bundle, Non-Bundle1, Non-Bundle2) using the my User account (who is of course Admin).
    As a side note, I do it by invoking the admin account from the standard user account and it works as expected.


    I have much more to share, but I'm a bit overcommitted atm. I'll be back to you in the next few days. Just on spoiler though... to keep you tuned. YES, as I said in my first post, the given commands WILL uninstall for all users on the machine, standard users, administrators, existing and future users and the removed apps WON'T re-appear even after a feature update. Tested. More on it in my next post - with all the due explanations.


    Cheers,
    Mark
      My Computer


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

    Hello @Dimitri and @Paul,
    a few (three) updates.



    FIRST - as I said at the end of my previous post, the apps removed with the proper commands won't re-appear even after a feature update.
    I tested this by uninstalling six or seven apps using a PS script I wrote last November. At the time I was running W10.0.19041. In December I upgraded to W10.0.19042 and the apps DID NOT come back. Since then I removed a bunch of other apps using the same script. None of them re-appeared so far. Sure I'll check again and post back after the next feature update.



    SECOND - I finally found some time to take a look at Paul's scripts. Now I understand why you had to go through the two-step process and use the built-in administrator, while I had no need to do so.
    I will focus on these two lines from the first script:
    Code:
    1.   Get-AppxPackage -Name $AppName | Remove-AppxPackage
    2.   Get-AppXPackage | Where-Object DisplayName -EQ $AppName | Remove-AppxPackage -ErrorAction SilentlyContinue
    And these two lines from the second script:
    Code:
    3.   Get-AppxPackage -Name $ProvisionedAppName -AllUsers | Remove-AppxPackage
    4.   Get-AppXProvisionedPackage -Online | Where-Object DisplayName -EQ $ProvisionedAppName | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
    Line 1 and 2 are meant to perform the same taks, so the second is basically a duplicate of the first.
    Actually, line 1 is slightly better than line 2, because it follows the "filter left" rule: the sooner you filter out, the better, because you avoid to shove unnecessary objects down the pipe. Not sure about the performance impact in this specific case, because I don't know how the filtering is implemented inside the Get-AppxPackage cmdlet. It is probably negligible, but I just prefer to filter as soon as possible.
    More important, line 2 will ALWAYS fail. This because the object returned by Get-AppxPackage contains fileds called Name and PackageFullName, but NO FIELD called DisplayName.



    THIRD - Last and most important, you're not removing for all users; see section two of my first post for the long of it.
    Here is the short. Basically, Remove-AppxPackage can be executed in three modes:
    https://docs.microsoft.com/en-us/pow...-ps#parameters
    MODE A: without specifying any user, as you do. The package is uninstalled ONLY for the user who runs the cmdlet. No elevation required.
    MODE B: with the -User parameter. The package is uninstalled ONLY for the specified user. Elevation required if the specified user is not the user running the cmdlet.
    MODE C: with the -AllUsers parameter. From the help page:
    This parameter removes the app package for all user accounts on the computer. The parameter works off the parent package type. If it is a bundle, use -PackageTypeFilter with "Get-AppxPackage" command and specify the bundle. To use this parameter, you must run the command by using administrator permissions.


    I'll try to perform additional tests to verify a couple of new ideas I had. More coming next week.
    Cheers,
    Mark
      My Computer


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

    ddelo said:
    Now why an app, like this one, does not show in the All Apps, is something that only the Redmond geniuses can answer... what we have to do, is to take into account that there are apps like this one!
    Even though I am not a Microsoft engineer, I do have the answer to this one. The thing is: what you call All Apps is not All Apps!

    First of all, let me recall that an app is something different from an app package. An app is usually made up of several app packages. There are also single-package apps, but even in such cases the logic difference is crucial when it comes to uninstalling. If you restrict to those apps which provide a GUI for uninstallig, you may not care about all this. But since we are looking for a univeral command, it is vital to keep in mind the difference. Why? Because there is no PowerShell cmdlet that works on apps, only cmdlets dealing with app packages.

    From the Get-AppxPackage help page:
    https://docs.microsoft.com/en-us/pow...-ps#parameters
    -PackageTypeFilter
    Specifies one or more comma-separated types of packages that the cmdlet gets from the package repository. Valid values are:
    * Bundle
    * Framework
    * Main
    * Resource
    * None
    By default, this cmdlet returns only packages of types Main and Framework.
    The first command you use builds a database of app packages of type either Main or Framework. The special app you found has a package of type Bundle, but no package of type Main or Framework!

    Out-of-topic extra tip: for the sake of completeness, I'd like to add that the -PackageTypeFilter parameter of Get-AppxPackage accepts an additional value which is not mentioned in the help page: All. Useful instead of a long comma-separated list.

    Cheers,
    Mark
      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 23:25.
Find Us




Windows 10 Forums