Serverspace Black Friday
JT
July 8 2024
Updated July 12 2024

What is winget and how to work with it?

Maintenance Networks Windows

To work with applications in the OS, various mechanisms and tools are used to manage the software environment. For Windows, the browser was usually used as a client for Web-servers and similar storages, for which it was necessary to find trusted software storage resources. Separately there was a package management service with a GUI shell, which required not a few actions from the user. And many other components, which were disparate, but fulfilled one function of a package manager!

What is Winget?

Winget is a Windows package manager that combines search, installation, uninstallation and full package management using repositories as sources. This solution is a client of the Windows Package Management Service and allows you to automate the installation process.

For recent versions of Windows 10 as well as Windows 11, this solution is pre-installed by default. However, versions below 1709 require manual installation of packages using the company's public repository.

.

What makes this solution different from regular scripts or binary files, which can also perform automated package installation, is its architecture and logic. Winget provides a single point of control over the OS software. By default, the package manager uses only the company's repository, where the software that has been checked for VPO and undeclared features gets to.

Validation
Screenshot №1 —Validation

If any problems are detected, the process of delivering the package to the repository is blocked. If necessary, the list of repositories can be modified by a configuration file and provided to employee workstations to use only trusted software source.

How does Winget work?

To work with the utility, open a terminal by pressing Win+X and selecting PowerShell or Terminal. Enter the command below:

winget; winget source update
Help page
Screenshot №2 — Help page

The utility help page will be displayed with a description of the syntax and possible commands to use. We will use the following semantics:

winget [<commands>] [<options>]

Commands are used to define the software functions to be called, and options help to define the parameters of their execution. For example, we need to find a package in the repository called MySql, for this we will use the command:

winget search -q  MySql
Search
Screenshot №3 — Search

In the left column is the name of the package, in the centre is its id as a combination of the name of the developer's repository and the package itself. Pay special attention, if you want to install the official version of the software, you need to choose according to the correct name of the publisher! Just the combination that is presented in the centre. In order to install a database from Oracle company, look for the corresponding line, which is presented last.

If you need to install community software, be sure to read the manifest file, which is brief information about the package and the download sources:

winget show Oracle.MySQL
Short info
Screenshot №4 — Short info

The Installer Url item indicates the source of the file download and you can follow the link and check it through antivirus and threat detection systems. You can also check the hash value or id of the file with the official data on the developer's website.

Let's move on to the installation for this purpose specify the id of the found package and write the following command. On the example of a database it will look like this:

winget install Oracle.MySQL
Installation
Screenshot №5 — Installation

All steps in the tutorial can be performed on powerful cloud servers. Serverspace provides isolated VPS / VDS servers for common and virtualize usage.

Create Server
Screenshot №6 — Create Server

It will take some time to deploy server capacity. After that you can connect in any of the convenient ways!

For a popup-free installation, use the utility's options, which can be viewed by typing the winget install command. Where it says that the -h or --silent option will be used for this kind of installation and looks like this:

winget install Oracle.MySQL --silent

.

After installing the package itself and the necessary dependencies, it will show up in the search, via the command:

winget list -q Oracle
Filter of package
Screenshot №7 — Filter of package

The process of removal is as simple as writing the command:

winget remove Oracle.MySQL

For more detailed familiarisation with the commands and subcommands of the utility use the help option for each of them, for example winget source -help.

How to update and change repository in Winget?

To change a repository, you need to invoke the winget source subcommand and start by looking at the list of existing repositories:

winget source list
Source list
Screenshot №8 — Source list

To add a new repository use the command:

winget source add -n [name] -a [url] -t [type]

To remove similar only with the remove subcommand, to add a corporate repository for multiple employees refer to the configuration file at the path %LOCALAPPDATA%\Microsoft\WinGet\Settings\settings.json and add the required sources:

{ "$schema": "https://aka.ms/winget-settings.schema.json", "sources": [ { { "name": "winget", "type": "Microsoft.Rest", "arg": "https://winget.azureedge.net/cache" }, { "name": "exampleRepo", "type": "Microsoft.Rest", "arg": "https://example.com/repo" } } ] } }

Then save and the repositories are ready to use! To learn how to add your application to a Microsoft repository, read our guides!

Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
33145 North Miami, FL 2520 Coral Way apt 2-135
+1 302 425-97-76
700 300
ITGLOBAL.COM CORP
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.