Uninstall any version or architecture of MSIX with PowerShell

A few days ago I’ve stumbled across a situation where an MSIX application was decided to be removed from all users in the infrastructure. However, there were many versions of the applications and some users even had multiple architectures installed on the machine. To make things much easier and in order to reduce the number of apps required in Intune, I decided that we go with a simple PowerShell script to achieve this.

For the script, we are going to use two PowerShell cmdlets targeted for MSIX/APPX applications: Get-AppPackage and Remove-AppPackage. Yes i know the links are saying Get-AppxPackage and Remove-AppxPackage, but you can use the previous aliases that I’ve mentioned, the results are the same.

So basically what we need is to parse all MSIX apps from the user and uninstall the ones we need. To do this, the script is as follows:

$test = Get-AppxPackage -name "*test*"

foreach ($app in $test){

    write-host $app.PackageFullname

    Remove-AppPackage -Package $app.PackageFullname

}
In the $test variable we are retrieving all the MSIX apps which have %test% in the name (with other characters in string at the beggining or end). Then foreach result, we remove the application by using the Remove-AppPackage cmdlet with the Package Full Name.
Hope this short tutorial might be of use if you ever have this issue.

Leave a comment

Your email address will not be published. Required fields are marked *

ten + ten =