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?