Getting started with Winget, the new Windows Package Manager

Linux is a terrific environment to manage if you value automation and are comfortable working from the command line and writing scripts. For example, working with Red Hat Enterprise Linux, I can use yum, a command-line tool, to install and remove individual packages and package groups and update packages already installed on my systems. PowerShell has added a lot of scripting power to managing the Windows platform, but until recently, Windows has lacked one key command-line utility: a package manager. But now, instead of having to use third-party package managers like Chocolatey, Windows devs and admins have their own made-in-Redmond (native) tool for automating the process of getting software onto their Windows machines. Its name is Windows Package Manager — but you can call it Winget. And it’s open-source!

To learn more about Winget, I’ve asked my colleague Jeffrey Hicks, who previously gave us an in-depth look into Windows Terminal, to do something similar for us with Winget. Jeffery is an IT veteran with almost 30 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis on automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award. He works today as an independent author, teacher, and consultant. Jeff has taught and presented on PowerShell and the benefits of automation to IT pros worldwide. He has authored and co-authored a number of books, writes for numerous online sites and print publications, is a Plural sight author, and is a frequent speaker at technology conferences and user groups. His latest books are The PowerShell Practice Primer and PowerShell Scripting and Toolmaking. You can keep up with Jeff on Twitter and on his blog.

So without further ado, here’s Jeffrey:

Package management crash course

If you are an IT pro, you have probably spent part of your career installing software on end-user desktops. You may still find yourself doing this for your own desktop. In the Windows world, there are software solutions to help you manage this task at an enterprise level. But many places still need to manage this task the old-fashioned way. That’s where package management comes into play.

Package management in the Linux world is given. You can find, install, upgrade, and remove software packages right from a command prompt. The package manager queries one or more online sources:

The package manager can install the package, and typically any dependencies as well:

Winget

The package is a self-contained bundle with the program and instructions on how to automatically install it without any user interaction. The package manager can show you what has been installed:

When the time comes, you can have the package manager check for updates and apply them. If necessary, it can also uninstall the package.

Microsoft has never had a true package manager for desktop clients. There are popular third-party tools such as Chocolatey, but never anything comprehensive from Microsoft. Until now.

Meet Winget

Microsoft has been working on a new command-line-based package manager for Windows called Winget. This is not a PowerShell tool but a true command-line utility like ipconfig, although you can run Winget from a PowerShell prompt. From what I can tell in reading about this project, Microsoft’s target audience is developers who need an easy and quick way to install and manage software applications on their Windows 10 (and soon 11) desktop.

Microsoft is maintaining an online repository of packages. The repository includes packages for Microsoft products such as Microsoft Teams and Visual Studio Code, as well as popular applications such as Dropbox and Google Chrome. In the future, Winget should also have access to the new Microsoft Store. For now, there is a single repository.

Winget has four primary tasks:

  • Search for packages
  • Install packages
  • Update packages
  • Uninstall packages

I’ll go through these steps in a bit more detail later.

Limitations

Of course, IT pros aren’t any different in their needs for managing desktop applications and packages, although I have to stress that Winget is not designed to be an enterprise-wide solution. Nor is it intended to deploy software packages to servers. In its current state, it is only suitable for interactive use on a local client machine.

The application doesn’t have much of a scripting interface. You can easily write a batch file to install a bunch of packages, but that’s about it. You also can’t run the application over a PowerShell remoting session or even ssh.

You’ll get this error:

There is an open issue on this problem, and I’m hoping at some point this won’t be a limitation, but sadly it is today.

And of course, this is a command-line utility, not a PowerShell cmdlet. While you can run Winget in PowerShell, there are no objects to leverage. This was an early issue that was brought up with a very lively discussion you can follow at this GitHub forum.

I’ll share a minor PowerShell workaround a bit later.

Installing Winget

As of the time I am writing this, Winget is still technically in public preview. I expect we’ll see an official release before the end of 2021. While there are some features we might have to wait on until the official release, Winget is stable enough that I have been using it for over a year.

Eventually, you should be able to install it from the Microsoft Store. That will be nice because then you’ll get automatic updates. It is technically possible to get Microsoft Store support today, but it requires additional steps that frankly don’t justify the effort. Since I expect you’re going to be kicking the tires on this yourself, a manual installation should be just fine.

You will need to be running at least Windows 10 1809. I’ve had no problems installing it on the current Windows 11 builds. There are apparently workarounds to get it installed on Windows Server 2019, but I would skip that until running Winget remotely is worked out.

The installation requires some app installer packages, which should already be installed on most Windows 10 desktops. And lastly, for now, you will need to install from a CMD prompt or Windows PowerShell 5.1. The install package I’m going to have you use is an msixbundle, which you can install using Add-AppxPackage. Unfortunately, PowerShell 7 currently has a problem loading the Appx module. If you want to install from a prompt, it has to be a CMD or Windows PowerShell prompt. Or you can simply double-click the file after you’ve downloaded it.

What do you download? Go to the project’s Github repository where you can get the latest release. Download the .msixbundle file:

Winget

You can double-click the file in Explorer to install it, or use Add-AppxPackage in Windows PowerShell:

If you are missing any of the requirements, the install should tell you. If you get an error about the missing VCLibs files, you should be able to download the file from here. Install the file:

Then install the DesktopAppInstaller package. The entire process should only take a minute.

Remember that installing from GitHub means Winget will not automatically update itself. You will need to manually install new versions as they become available. And oddly, there is no Winget package that you can install with Winget!

One final install option is to use my WingetTools PowerShell module, which I’ll mention at the end of the article.

Getting help

Once installed, you can simply type Winget at a command or PowerShell prompt:

Winget

As you can see the help is pretty clear. Personally, the most helpful bit of additional information is the home page URL:

Winget

But, it doesn’t take you where you think it will. The link points you to the Github repository that contains package manifests. Unless you are authoring packages to be installed by Winget, this probably isn’t going to be very useful to you.

Each Winget sub-command likely has additional help. Use -? to view it:

Winget features

Depending on the version, Winget may have additional experimental features. These are typically disabled by default:

As you can see, if you want to enable a feature, you need to configure settings.

Configuring Winget

Settings for Winget are stored in a JSON file. Although you might find some community-created front-end tools. Otherwise, run Winget settings to open the file. If you have an associated application, like Visual Studio Code, the file will open in that. Otherwise, you’ll have to pick another application like Notepad. You’ll see something like this:

I like that the Winget team includes a link where you can get more information about what you can configure. I’ll let you read their documentation, but point out some of the settings I think you’ll want to change. Here’s a configuration file I’m going to use:

Because this is a JSON file, watch your casing. If you use Visual Studio code, it will know how to use the schema and give you Intellisense help. When you save the file, the changes take effect immediately.

In the second and concluding part of this series, we’ll look at how to find packages, install and uninstall them, and update them.

Featured image: Shutterstock

About The Author

Leave a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top