We are uninstalling most Appx packages for our users upon deployment of Windows 10 machines. We are using something like this two-liner is sufficient to get rid of most UWP apps on the systems:
# remove the "provisioning" of packages for new users
Get-AppxProvisionedPackage -Online | % { Remove-AppxProvisionedPackage -Online -PackageName $_.PackageName }
# delete packages for existing users
Get-AppxPackage -AllUsers -PackageTypeFilter Bundle | % { Remove-AppxPackage -Package $_.PackageFullName -AllUsers }
Now, as we need to give users the choice to bring them back, the trouble is starting.
I failed to find a working method to re-register the "removed" Appx-Packages which seem to have been moved to C:\Program Files\WindowsApps\DeletedAllUserPackages
.
Most of the solutions on the net are using (Get-AppxPackage).InstallLocation
1 and use it to -Register
the app with Add-AppxPackage. This does not work for us – at least as of 1709, Get-AppxPackage -PackageTypeFilter Bundle -AllUsers
is returning an empty list and the call without -PackageTypeFilter Bundle
does not contain any of the uninstalled apps.
My attempts to simply use C:\Program Files\WindowsApps\DeletedAllUserPackages\<PackageFullName>\AppxManifest.xml
as the value to Add-AppxPackage -Register
failed due to unresolved dependencies.
But even if Add-AppxPackage
succeeded, it only would be registering the app for the current user as it seems to be missing the -AllUsers
parameter. Other users and potential new users would not get the app installed.
Other documented approaches use Add-AppxProvisionedPackage -Online
from the DISM
module. But this apparently needs an .appxpackage
file, which seems not to be present on the system.
For given apps like the Microsoft Store, I apparently could use the original WIM image to reinstall the app, if I only knew the dependencies, which I don't. So how could I administratively reinstall all the apps I uninstalled in the course of the initial system setup?
Best Answer
If I didn't misinterpret the answer from an MVP that I read a couple of days ago in the Microsoft forum, you have to use the Store App to reinstall the built-in Apps. You can even do that without a Microsoft account.
But I'm wondering why you seem to blindly remove all provisioned packages and all bundled apps in the first place?
I mean, with those two lines of code you use ...
... you remove (besides other stuff that really is not important):
Granted, some are debateable, like MSpaint or sticky notes. But why remove the photo viewer? Why the calculator? Unless you have an alternative in place, I would not remove them and cripple your users. But because you want to offer them to reinstall those apps, I assume you don't.
Other apps should better be disabled with GPOs, such as the Store App. And The Desktop App Installer is important if you want to side-load certain apps in your enterprise.
Without knowing the motivation behind it, I'd say that you are causing yourself and your users unnecessary trouble. Why not just keep the apps installed and perhaps provide your users the options to uninstall them, instead of doing in the other way round. That's technically much easier.