How to Programmatically Install Microsoft Store Apps Using Windows Package Manager

Last Update: Sep 04, 2024 | Published: Oct 28, 2020

SHARE ARTICLE

Microsoft updated its Windows Package Manager preview software in time for Ignite in September. The new version (v0.2.2521) is available via the Microsoft Store for those registered in the Windows Insider Program, and for those that have joined the Windows Package Manager Insider Program. Alternatively, the client software can be downloaded from GitHub.

What is Windows Package Manager?

A package manager is a tool for automating installing, upgrading, configuring and removing software. Windows has never had its own built-in package manager. Although there is Nuget for Visual Studio; and Chocolatey, an open-source package manager for Windows. There is also OneGet, a PowerShell module designed to bring together different package management providers under the control of a single API.

Windows Package Manager (WPM) is a new open-source package manager for Windows 10. Microsoft hosts a trusted WPM repository of software on GitHub. The WPM repo includes app manifests that are automatically checked using SmartScreen, static analysis, SHA256 hash validation, and a few other processes to limit the chances of malware getting into the repository.

For more information on installing and using the Windows Package Manager preview, check out How to Use Windows Package Manager on Petri.

Enabling support for Microsoft Store apps in Windows Package Manager

Until the latest preview release of WPM, there has been no way to programmatically install applications hosted in the Microsoft Store. WPM version 0.2.2521 changes that. Microsoft is initially hosting 300 applications from the Store that can be installed using WPM. The apps are all free and rated E for everyone.

For the time being, the ability to install Store apps using WPM is an experimental feature that you should enable if you want to use it. To enable Store support, all you need to do is add the following block of code to your WPM settings file:

    "experimentalFeatures": {

        "experimentalMSStore": true

    }

The WPM settings file is in JSON format and it is located in %LOCALAPPDATA%PackagesMicrosoft.DesktopAppInstaller_8wekyb3d8bbweLocalState. Alternatively, you can run winget settings and the settings file will open in the default JSON editor on your system. You can find more information on the WPM settings file here on GitHub.

Image #1 Expand
1725499658 Figure1 7
How to Programmatically Install Microsoft Store Apps Using Windows Package Manager (Image Credit: Russell Smith)

 

Once the Store source is added to WPM, you can search and install for Microsoft Store apps like you would for apps in the WPM repo. If you run winget source list, you’ll now see msstore in the list of available sources.

Install an app from the Microsoft Store

First, let’s search for the Nightingale REST Client in the Microsoft Store using winget.

winget search nightingale

In the terminal window, you’ll see complete information about the package, including the full package name. Now all we need to do is use winget install to install the client.

winget install "Nightingale REST Client"

Image #2 Expand

1725499658 Figure2 3
How to Programmatically Install Microsoft Store Apps Using Windows Package Manager (Image Credit: Russell Smith)

 

What’s interesting is that if you have the Microsoft Store open at the same time as running winget install, you’ll see the install progress updating in real time in both the command line window and the Store GUI (Image 2).

Image #3 Expand
1725499661 Figure3 3
How to Programmatically Install Microsoft Store Apps Using Windows Package Manager (Image Credit: Russell Smith)

New Windows Package Manager features coming soon

Windows Package Manager is shaping up nicely at this stage but there’s still a lot of work to do before it becomes useful. At the moment, WPM cannot be used to remove or upgrade packages. Microsoft is planning to add both these features soon. Additionally, the ability to list installed packages, regardless of the technology used to install them, and a feature that allows you to export and import packages for setting up new devices, are in the works.

Related Article:

SHARE ARTICLE