Use winget to install Microsoft Store apps on Windows 11
As we all know by now, the Microsoft Store for Business is being deprecated by 2023. What are your alternatives if you still want to deploy Microsoft Store applications, though? We use winget!
Winget is natively built into Windows 11. If you want to try it out yourself, open Terminal, Command Prompt, or PowerShell and run: winget search searchphrase
In the example above, we search for “company” and get a list of available apps from the Store. But only after we agree to the terms of the Store. If we want to script a solution using winget to install apps, we’ll need to automatically accept that agreement and make note of the Id of the app we want to install.
Here’s what that command would look like for installing the Company Portal:
winget install --id "9WZDNCRFJ3PZ" --exact --source msstore --accept-package-agreements --accept-source-agreements
And then we have successfully installed the app!
This does require winget 1.3 (which as of writing is in preview). Before 1.3, installing Store apps from winget required a Microsoft Store/MSA account, but we can confirm on GitHub that was fixed. So if you do happen to run into a “No store account found” error when attempting to install, it may be because App Installer (winget) was not up to date. To check, run:
winget --version
Now, since we don’t want to run that command on every device manually to install apps from the Store, we’ll need to deploy that command. This could either be as a script or Win32 app in MEM.
If we want to do a script, all we need to do is save the command as a .ps1, and then upload to Microsoft Endpoint Manager > Devices > Scripts > + Add > Win 10 or later:
Provide a name:
Upload the script (and select run script in 64 bit PowerShell Host):
Then assign and click Add!
In just a few moments, you’ll see the app installed on your targeted devices:
Alternatively, and perhaps more effectively, you could wrap the script in a Win32 app which gives you the huge benefit of have requirement/detection rules to validate that the app was actually installed (rather then just validating the script ran). This may be a better approach for larger enterprise deployments.
And exploring even further – there are a host of other winget commands to explore which you can find on this Docs article. You could even script winget to install apps in a certain order! If you have any questions around winget or are looking at interesting scenarios, comment below. 🚀
Is there a way i can deploy apps system-wide from the MS Store using winget ?? like a script or something but apps must be available for all users ..