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.
.
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.
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
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
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
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
All steps in the tutorial can be performed on powerful cloud servers. Serverspace provides isolated VPS / VDS servers for common and virtualize usage.
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
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
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!