The -AllUsers switch on Add-AppxPackage requires Windows 10 build 1809 or later. It registers the app for all users currently registered on the system. How to Verify the Installation
本文将指导你如何使用 PowerShell 命令为所有用户安装 MSIX 应用,并讲解其背后的原理。
The basic installation of an MSIX package for the current user can be done using:
This older cmdlet provisions a package for all users that will be installed when any new user logs in.
The built-in AppX/Provisioning modules are required. install msix powershell all users
If you are embedding this workflow into a deployment tool like Microsoft Intune, SCCM, or a group policy startup script, use this optimized template script: powershell
Method B — Add-AppxPackage for each existing user (elevated, per-profile)
This is the most common scenario, where you have a single MSIX file and its associated dependencies (if any). 1. Open PowerShell as Administrator
The most robust way to make an MSIX available to all users is to provision it using the Deployment Image Servicing and Management (DISM) cmdlets in PowerShell. Step-by-Step Command The -AllUsers switch on Add-AppxPackage requires Windows 10
Install-MsixPackage -FilePath "C:\MyApp.msix" -InstallScope Machine
It's important to note that there is no direct way to provision an unsigned package machine-wide. Unsigned packages can only be installed in a per-user context.
Add-AppxProvisionedPackage -Online -PackagePath "C:\Path\To\YourApp.msix" -SkipLicense Use code with caution. Copied to clipboard
However, system administrators frequently need to install applications for on a shared workstation, VDI environment, or laboratory machine. The built-in AppX/Provisioning modules are required
Add-AppxPackage -AllUsers -Path "C:\Path\To\YourApp.msix"
# Enable sideloading Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" -Name "AllowAllTrustedApps" -Value 1 -Type DWord
: The full path to your .msix or .msixbundle file.
After running the provisioning command, verify that the package is successfully staged for all users by querying the system repository.