Deploy apps with Windows Package Manager

The “new” Windows Package Manager – or WinGet – will be the replacement of the current Windows Store for Business (WSfB). Since the WSfB is announced end of life for next year (https://learn.microsoft.com/en-us/microsoft-store/microsoft-store-for-business-overview), we need to start looking into WinGet to manage applications.

WinGet is a full open source application manager that is managed by Microsoft. WinGet can install applications from three sources:

  1. Windows Store
    You can deploy and install public store apps.
  2. Public Repository
    Microsoft provides a public community repository. https://github.com/microsoft/winget-pkgs
    There are already hundreds of preconfigured applications added.
  3. Private Repository
    You also have the option to host your own repository and add line of business apps to it that are maintained by the company administrators.

Before you start, you need to deploy WinGet to the devices. After you deployed WinGet you can install the application out of the three sources.
This article will focus on the Public Repository.

Deploy WinGet

You have three possibilities to deploy WinGet:

  1. Via Windows Store application https://apps.microsoft.com/store/detail/app-installer/9NBLGGH4NNS1
  2. Use the MSIX bundle installer for Workspace ONE UEM higher as 22.10
  3. Use a script to install the MSIX package

You get the latest WinGet release here: https://github.com/microsoft/winget-cli/releases

Add the application to Workspace ONE

Upload .msixbundle with UEM 22.10:

You’ll see, that Workspace ONE is checking for missing dependencies. In the MSIX bundle package, there are two missing dependencies that need to be added.

You can download the dependencies here:

https://www.nuget.org/packages/Microsoft.UI.Xaml/
the Microsoft UI XAML package needs to be extracted (the path to the .appx package is tools\AppX\x64\Release)

and

https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx

After you added the package, you can deploy it to your devices.

Use a script application for deployment

If your environment is not on 22.10, you can use this script to download and install the latest Windows Package Manager.

function Get-GithubLatestRelease {
    param (
        [parameter(Mandatory)][string]$project, # e.g. paintdotnet/release
        [parameter(Mandatory)][string]$pattern, # regex. e.g. install.x64.zip
        [switch]$prerelease
    )

    # Get all releases and then get the first matching release. Necessary because a project's "latest"
    # release according to Github might be of a different product or component than the one you're
    # looking for. Also, Github's 'latest' release doesn't include prereleases.
    $releases = Invoke-RestMethod -Method Get -Uri "https://api.github.com/repos/$project/releases"
    $downloadUrl = $releases |
                   Where-Object { $_.prerelease -eq $prerelease } |
                   ForEach-Object { $_.assets } |
                   Where-Object { $_.name -match $pattern } |
                   Select-Object -First 1 -ExpandProperty "browser_download_url"

    return $downloadUrl
}


$URL = Get-GithubLatestRelease -project "microsoft/winget-cli" -pattern "Microsoft.DesktopAppInstaller.+.msixbundle" 

Add-AppPackage -path "$PSScriptRoot\Microsoft.UI.Xaml.2.7.appx" -Verbose

Add-AppxPackage 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx' -Verbose

Add-AppxPackage "$URL" -Verbose

As detection you can use the following PowerShell script:

try
{
    winget -v
}
catch
{
   
    exit 1234
}

exit 0

Install a WinGet application

After you installed WinGet, you now can now go ahead and deploy applications.
The easiest way is to use the Workspace ONE Script function.
Create a new script – if you want to show the app in the app catalog, enable this function and add an icon.

This will help the end user to find the right application – regardless if the app is a real Win32 packaged application or a WinGet packaged application.
Next, select Details and configure the script as you need, e.g., Execution Context.
Make sure you increase the timeout setting, since the application gets downloaded first and then installed.

The code itself is quite simple to use:

winget install APPLICATIONNAME --accept-package-agreements --accept-source-agreements

Replace “APPLICATIONNAME” with the WinGet application name. The two parameters are to make sure that all agreements are accepted, and the application will install in silent mode.

After you created the script, you can deploy the script to the device.

In the Intelligent HUB you will see no difference between a normal application and a scripted application.

And after some minutes, you’ll see the installed application:

The only difference is, that the end user don’t get any toast notification if a script gets executed.

Written by
+ posts

Empowering customers in client management since 2012.
Empowering customers in modern management since 2018.

3 thoughts on “Deploy apps with Windows Package Manager

  • Jesus
    2023-03-10 at 20:45

    Hi, Thanks for the the write-up. I’m confused – is “MSIX bundle installer for Workspace ONE UEM higher as 22.10” a prepackaged application or do i need to somehow put this together myself?

    • Grischa Ernst
      2023-04-03 at 12:41

      You need to download the msix bundle from the github site.
      UEM 22.10 is required since you need msix support – which was implemented in 22.10

  • Wannes De Boodt
    2024-07-11 at 07:49

    Hi Grischa,

    Perhaps interesting to note that the CIS baseline disables the App Installer usage by default. Resulting in this error: This operation is disabled by Group Policy: Enable Windows Package Manager.

    Best regards,
    Wannes

Leave a Reply

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

*
*

This site uses Akismet to reduce spam. Learn how your comment data is processed.

BCF Shop Theme By aThemeArt.
BACK TO TOP