WWW.COMPUTERWORLD.COM
WinGet: The best way to keep Windows apps updated
For more than two years, Ive been working with WinGet daily to monitor and maintain the apps on my Windows 10 and 11 PCs. For those not already in the know, WinGet is the built-in, command-line interface to Microsofts Windows Package Manager service. It works in both PowerShell and Command Prompt with equal facility.WinGet is designed to enable users to discover, install, upgrade, remove and configure applications on Windows 10 and 11 computers, according to Microsoft Learn. In my experience, WinGet is helpful for checking and updating most applications that run on Windows.Please note: WinGet is included with Windows 10 version 1709 and later, and all versions of Windows 11 as the App Installer. If youre running an earlier version of Windows 10, visit the WinGet home page at GitHub. There, click the Latest button under Releases at right, and download the item named Microsoft.DesktopAppInstallermsixbundle (the missing characters identify Microsoft Store apps). Double-click on this item to install it.(Dont worry: if you do this on a newer Windows version, it will inform you, The App Installer is already installed.)Exploring a PC using WinGetUsing WinGet starts with opening an administrative command line session. Press the Windows key + X, then pick Terminal (Admin) or PowerShell (Admin) from the pop-up menu. (I use PowerShell and will use it for examples throughout this story.) Given that WinGet runs in PowerShell, it uses straightforward PowerShell syntax to provide information or perform actions. WinGet tells you about itself if you enter the command:winget --info(Although Ive followed Microsofts lead in labeling this command WinGet, the command line doesnt care about capitalization.)As you can see in Figure 1, the output from this command shows the running version of Windows Package Manager, along with the OS Build number, system architecture, Microsoft.DesktopAppInstaller version, and symbol values for WinGet directories, links, and Admin Settings.Figure 1: Output from WinGets info command tells you about the system, plus WinGet-related software and settings.Ed Tittel / IDGThis information can be helpful, but its not terribly interesting, nor have I found it super-useful in day-to-day WinGet use and troubleshooting.Things get more interesting with WinGets two information display subcommands: list and show. The list subcommand shows whats currently installed on the target PC, while the show subcommand searches an online database of available packages to show you information about matching search hits.With no qualifiers or queries, winget list shows a list of every item installed on your PC (177 items on an up-to-date Windows 11 production PC; 339 items on a heavily used production Windows 10 PC). All standard executables and Microsoft Store apps are included in this count.Winget show wont do anything unless you provide it with a search string. Its normally used to search for specific packages, or to see if they exist. Try it with search strings such as windows, power, powershell and so forth. Its soon obvious that this is a more focused tool. I use it primarily when WinGet tells me a package needs an upgrade. It helps me find complete IDs, version numbers, and publisher, and tells me where it came from. (That usually means WinGets package repository or the Microsoft Store.)The winget search command can be more helpful than show if youre looking for something specific. It lists all items that include the search string. Thus, if you use the same strings recommended in the preceding paragraph, youll get more and more interesting results.Figure 2 shows the output for winget search PowerShell as an illustration. (It shows items with PowerShell in their names, IDs, and tags, so its more inclusive.)Figure 2: Matching on PowerShell is especially useful for tagged items, particularly Windows Terminal and related applications.Ed Tittel / IDGWinGets star subcommand: upgradeMy favorite among the WinGet subcommands is the upgrade item. It offers insight into available upgrades and offers various ways to perform upgrades on a Windows PC. Indeed, three variants of winget upgrade are likely to be both useful and informative:winget upgradewinget upgrade --allwinget upgrade --all --include-unknownBy itself, winget upgrade (no additional arguments or modifiers) simply tells you if newer versions of installed packages are available. Figure 3 shows an example of this command from one of my production level test PCs, with some items in need of update. Notice that the Version column identifies the version thats currently installed. The Available column identifies the corresponding new (updated) version one could apply in its stead, if desired.Figure 3: Seven updates are available for the target PC, as shown.Ed Tittel / IDGThe next command, winget upgrade --all, tells WinGet to update all items from the upgrade list for which a version number is known. In Figure 3, all items have values in the Version column. Note further that all packages shown come from the default WinGet package repository (named winget in Figure 3).The third command, winget upgrade --all --include-unknown, tells WinGet to update all items even if the version column is blank. In general, this command is more useful because it involves less additional work. Thus, I use it as my go-to for all winget upgrade commands, just to make sure I cover everything.Figure 4 shows results after running that catch-all command on the target PC. (Ill have more to say about this figure later.)Figure 4: On this production PC, WinGet finds and installs four upgrades, but leaves the fifth alone.Ed Tittel / IDGNote that youll sometimes see installer windows and even PowerShell or Command Prompt sessions open and close as WinGet goes through the necessary motions involved in performing those updates. Note further: when updating web browsers Edge, Chrome, or Firefox, for example if the browser is running when you run WinGet, you must relaunch that browser manually before the update fully completes. If its closed, it completes on its own. (WinGet always applies an abundance of caution when it encounters running processes.)Running winget upgrade again after performing all updates shows nothing left to do. In Figure 5, the message No installed package found matching input criteria translates into Nothing to upgrade.Figure 5: No installed package found matching input criteria means Nothing to upgrade.Ed Tittel / IDGAbout pinned applications (and other experimental WinGet features)If you look back at Figure 4, youll see the sentence The following packages have an upgrade available, but require explicit targeting fairly near the top, with Discord listed below. What does that mean, and why does this happen? Some application developers, including Discord, use advanced WinGet features pinning in this case (look back at the final line of Figure 4) to prevent unwanted changes to the Discord app. It usually updates inside the app so this approach (mostly) prevents WinGet from getting involved.On the other hand, you can always use WinGet to uninstall an app, and then use WinGet one more time to reinstall. For Discord, that command sequence looks like this:winget uninstall Discord.Discordwinget install Discord.Discord(Note at the head of Figure 4, the ID value for Discord is Discord.Discord, so thats how we specify these commands.)The first command removes (the old version of) Discord; the second command installs (the new version of) Discord. Its what I call a remove-replace operation, and it works pretty well for general WinGet troubleshooting, too. Ive also used it recently for Zoom Workplace, various Teams versions, and other occasional vexations.For the record, the pin command is a relatively new subcommand for WinGet. It first appeared in general release in July 2024. According to Microsoft Learn, the winget pin command allows you to limit the Windows Package Manager from upgrading a package to specific ranges of versions, or it can prevent it from upgrading a package altogether.Another special qualifier, namely --include-pinned, lets you override this restriction. But because Discord is the only item in my stable of apps that uses this restriction, its not worth adding to my go-to command string.When the upgrade command fails or falls shortSometimes, WinGet updates dont clear the items that appear when you enter the winget upgrade command by itself. That means something remains on your PC that WinGet couldnt handle. Through experience, Ive observed the following possibilities, each of which has its own potential solution:Multiple copies of the same app or application are resident. If you have multiple installations of the same program, only one is likely to be current and up to date. Unless you require older versions, the simplest fix is to uninstall them so only the current, updated version remains present.Ive seen this happen with PowerShell, for example, where some of my PCs retained version 7.2.5 even when 7.4.5 or 7.4.6 (the current version as I write this) was also present. Using Programs and Features (or some equivalent third-party tool like Revo Uninstaller Free), you can find and uninstall out-of-date versions.Strange programs that youve never seen before and dont need show up. Case in point: occasionally an item named Teams machine-wide installer shows up on my PCs. Its something Microsoft uses that apparently gets left behind from time to time. Uninstalling this item causes no noticeable issues with Teams, and it removes the item from further upgrade consideration.Current WinGet packages arent available for some apps. One of WinGets limitations is that it only works with items registered in its package database. You may need to visit the app publishers website to find current updates that arent registered with WinGet.In the past, Ive covered using third-party automated tools such as UpdateStar and Patch My PC to keep apps updated in Windows 10 and 11. These and other update scanners may find items in need of updating on your PC that WinGet doesnt handle. On my PCs, that includes applications such as Nitro Pro (a PDF reader/editor), Amazon Kindle (for which only an outdated package is available via WinGet), FileZilla, various Intel tools (e.g., Intel Driver & Support Assistant), and more.If youre willing to research your applications and their sources for updates, you can almost always find a way to get them updated. That said, WinGet cannot handle all apps on its own. Many or most of them, yes; all of them, no.A WinGet for all seasonsAs you become familiar with WinGet, youll find it to be a terrific tool for helping keep Windows systems (and reference or canonical Windows images for automated deployments) up to date. Its become my tool of choice for keeping apps updated because its fast and easy to use. Although I still use UpdateStar to scan my systems to tell me what needs updates and Patch My PC to handle a handful of things that WinGet cant, WinGet remains my go-to tool to keep systems current. I use WinGet every day; the other tools weekly, at most.If you try it for yourself, I believe youre likely to continue using WinGet for the very same reasons. SeeMicrosofts WinGet documentationfor a complete list of commands and options.One final note: If you know someone who could benefit from WinGet but isnt comfortable using the command line, see this article by Chris Hoffman detailing how to use WingetUI, a package that wraps a graphical interface around WinGet.This article was originally published in January 2023 and updated in December 2024.
0 Σχόλια 0 Μοιράστηκε 20 Views