Several months ago, VMware released a great article (here) on creating an optimized Windows 10 image for VDI environments. One issue with the article is that they have a ‘scorched earth’ policy in regards to Windows 10 UWP apps – that is – they all get removed if you follow the guide. This is not acceptable to most customers, as the majority still want the Calculator app on their VDI image.
I spent many hours researching methods to add the calculator back in, and found many blog articles with commands that simply didn’t work.
I came across a blog article on how to add apps back after they were removed using the method VMware details, but it required downloading a 4GB file from the Microsoft VLSC.
This method worked, but it wasn’t ideal for the situation.
I’m a PowerShell novice, but I figured there had to be an easier way. There is.
VMware’s guide has you run the following commands:
Get-AppxPackage -AllUsers | Remove-AppxPackage
Get-AppxProvisionedPackage -online | Remove-AppxProvisionedPackage -online
We’ll add some qualifiers to exclude the Windows Calculator… the new commands are:
Get-AppxPackage -AllUsers | where {$_.Name -notlike "Microsoft.WindowsCalculator"} | Remove-AppxPackage
Get-AppxProvisionedPackage -online | where {$_.DisplayName -notlike "Microsoft.WindowsCalculator"} | Remove-AppxProvisionedPackage -online
If you need to exclude multiple apps, it would look like this:
Get-AppxPackage -AllUsers | where {$_.Name -notlike "Microsoft.WindowsCalculator"} | where {$_.Name -notlike "Microsoft.WindowsStore"} | Remove-AppxPackage
Get-AppxProvisionedPackage -online | where {$_.DisplayName -notlike "Microsoft.WindowsCalculator"} | where {$_.DisplayName -notlike "Microsoft.WindowsStore"} | Remove-AppxProvisionedPackage -online
There may be a more elegant way to do this, but it’s simple and works. I hope this saves you some time.