MSIX PowerShell Cmdlets
MSIX uses the same PowerShell cmdlets available for AppX packages. But Microsoft added aliases for them to no create confusion between the AppX and MSIX package. Let’s go through some of them with a few examples
To install an MSIX from Powershell run the command:
Add-AppPackage -path "C:\Caphyon\MyApp.msix"
The same command works for MSIX bundles as well
Add-AppPackage -path “C:\Caphyon\MyBundle.msixbundle”
To remove an MSIX from powershell you can use
Remove-AppPackage -Package "Caphyon.MyApp_126.96.36.199_neutral__8wekyb3d8bbwe"
The removable package name is composed like Vendor.AppName_Version_Build_Hash, where Build can be neutral or X64. To remove the MSIX from all users you can use
Remove-AppPackage -Package "Caphyon.MyApp_188.8.131.52_neutral__8wekyb3d8bbwe" -AllUsers .
To remove it from all users you need to run the command as an administrator.
If you want to find additional information about a package, you can use
Get-AppPackage -name “Caphyon.MyApp”
This returns multiple fields, like for example, the PackageFullName.You can use this to run the uninstall command mentioned above. If you want to find out all the MSIX/Appx packages installed you can use Get-AppPackage, or you can use Get-AppPackage -User “Domain\Username” to get all the packages installed for a specific user.
By default, all the MSIX/Appx packages are installed in %ProgramFiles%\WindowsApps, but you can change that in a few simple steps. First, if you need, you can add a new Appx volume with Add-AppxVolume -Path "E:\WindowsApps"
It’s necessary to specify \WindowsApps after the volume you choose.
After you added the new Volume you can set it as default using Set-AppxDefaultVolume -Volume E:\.Now all your MSIX/Appx packages are installed by default in E:\WindowsApps.
With the new volumes in place you can move installed MSIX packages by using
Move-AppPackage -Package "Caphyon.MyApp_184.108.40.206_neutral__8wekyb3d8bbwe" -Volume E:\
To dismount a volume you can use Dismount-AppxVolume -Volume E:\
To remove a volume use Remove-AppxVolume -Volume E:\
If you dismount a volume you cannot use the installed applications on that location
You cannot remove a volume if any user has applications left on that location. You must first move/remove them.
To run an application inside the MSIX container you can use the Invoke-CommandInDesktopPackage cmdlet.
If you want to launch cmd.exe in your container you can use
Invoke-CommandInDesktopPackage -PackageFamilyName "Caphyon.SampleMSIXPackage_r21n0w1rc5s2y" -appid "SampleMSIXPackage" -command "cmd.exe" -preventbreakaway
To view the merged registry hive, you can open up regedit.exe inside the MSIX with
Invoke-CommandInDesktopPackage -PackageFamilyName "Caphyon.SampleMSIXPackage_r21n0w1rc5s2y" -appid "SampleMSIXPackage" -command "regedit.exe" -preventbreakaway
To find out your MSIX AppID check out this blog
For more cmdlets visit https://docs.microsoft.com/en-us/powershell/module/appx/?view=win10-ps