In March 2023, I wrote a weblog put up in regards to the Preview model of the WinGet module. Since then, it has undergone many updates, and on this (lengthy) weblog put up, I’ll present you the right way to use Microsoft.WinGet.Consumer PowerShell Module.
What’s WinGet?
“WinGet is a command line device enabling customers to find, set up, improve, take away and configure functions on Home windows 10, Home windows 11, and Home windows Server 2025 computer systems. This device is the consumer interface to the Home windows Bundle Supervisor service.”
Supply: https://study.microsoft.com/en-us/home windows/package-manager/winget/
What’s the Microsoft.WinGet.Consumer Module?
This PowerShell module means that you can use the WinGet command line device with cmdlets. It additionally has some glorious options that can assist you set up or preserve your WinGet set up.
The Cmdlets that you should utilize are:
Notice: For the cmdlets of the Microsoft.WinGet.Consumer module to work, you do want a working WinGet command line device in your system. Verify the Restore-WinGetPackageManager chapter if it’s not put in in your system. Nonetheless, in a current Home windows Consumer working system, it must be there by default (It’s even accessible on Home windows Server 2025 now!)
Learn how to set up the WinGet PowerShell module
Within the early preview variations, you needed to set up the module by downloading the recordsdata and importing them manually. This has modified to the usual set up technique, and you’ll set up it now by operating the next:
Set up-Module -Title Microsoft.WinGet.Consumer Import-Module -Title Microsoft.WinGet.Consumer
Microsoft.WinGet.Consumer module cmdlets
Add-WinGetSource
You should use this so as to add new WinGet supply areas on your packages. WinGet helps you to use your personal inner or safe location for personal packages. You should use this for instance:
Add-WinGetSource -Title mysource -Argument https://interal.powershellisfun.com/ -Kind Microsoft.Relaxation
I couldn’t discover any details about various kinds of Microsoft.Relaxation is talked about within the examples, however I couldn’t discover reference information for that. The sort that’s returned by operating Get-WingetSource is Microsoft.Relaxation (msstore) and Microsoft.PreIndexed.Bundle (winget).
Assert-WinGetPackageManager
This may confirm if WinGet is put in appropriately. It may be used with three parameters:
- -Newest This may examine if the put in WinGet model is appropriate with the put in Microsoft.WinGet.Consumer module will return nothing/no error if that’s the case. In my case, as a result of I’m operating a Preview model, it returned this:
- -IncludePreRelease If the WinGet model is appropriate with the put in Microsoft.WinGet.Consumer module, the cmdlet will return nothing/no error.
- -Model You possibly can specify to examine for a particular model, for instance, Assert-WinGetPackageManager -Model v1.8.1911. If it’s appropriate, it’s going to return nothing/no error.
Disable-WinGetSetting
This can be utilized to disable an Administrative setting and should be run as an Administrator. It has 5 values that you should utilize for the -Title Parameter:
- – BypassCertificatePinningForMicrosoftStore This may disable Microsoft Retailer certificates checking; this must be prevented due to the chance of Man-in-the-Center assaults. (Nevertheless it is likely to be useful throughout testing/improvement as a short lived factor)
- – InstallerHashOverride This may disable the Hash examine throughout set up, which might be useful when packages are up to date and the Manifest isn’t up to date.
- – LocalArchiveMalwareScanOverride This may disable scanning an area Manifest file, which is likely to be useful in non-public sources.
- – LocalManifestFiles This may disable the usage of native Manifest recordsdata.
- – ProxyCommandLineOptions This may assist you to disable supplying Proxy choices.
For instance (I used -Verbose as a result of it doesn’t show something if the command executes efficiently):
Allow-WinGetSetting
This will allow an administrative setting and should be run by an administrator. It has 5 values that you should utilize for the -Title Parameter:
- BypassCertificatePinningForMicrosoftStore This may allow Microsoft Retailer certificates checking.
- InstallerHashOverride This may allow the Hash examine throughout set up.
- LocalArchiveMalwareScanOverride This may allow the scanning of an area Manifest file.
- LocalManifestFiles This may allow the usage of native Manifest recordsdata.
- ProxyCommandLineOptions This may allow you to produce proxy choices.
For instance (I used -Verbose as a result of it doesn’t show something if the command executes efficiently):
Export-WinGetPackage
This may assist you to obtain a WinGet package deal from a configured supply. It would obtain the package deal, manifest, and its dependencies. The parameters for the cmdlet are:
- -AllowHashMisMatch helps you to obtain the package deal even when the SHA256 hash doesn’t match the package deal manifest.
- -Structure You possibly can specify the processor structure for the WinGet package deal installer. The values are Arm, Arm64, Default, X64, or X86.
- -DownloadDirectory Specify the obtain listing. The default is the consumer’s Downloads folder.
- -Id You possibly can specify the WinGet package deal identifier, comparable to Notepad++.Notepad++
- -InstallerType Use this to specify the kind. Values are: Default, Inno, Wix, Msi, Nullsoft, Zip, Msix, Exe, Burn, MSStore and Moveable
- -Locale Use this to specify the locale. For instance, en-US of nl-NL.
- -MatchOption This specifies the match choice when querying packages. Values are Equals, EqualsCaseInsentitive, StartWithCaseInsensitive, ContainsCaseSensitive
- -Moniker Specify the moniker of the WinGet package deal to obtain. For instance, the moniker for the Microsoft.PowerShell package deal is
pwsh
- -Title Specify the title of the WinGet package deal to export
- -PSCatalogPackage You possibly can specify the PSCatalogPackage object, which could be discovered utilizing Discover-WinGetPackage
- -Scope Specify the WinGet package deal installer scope. Values are Any, Consumer, System, UserOrUnknown, SystemOrUnkown
- -SkipDependencies Use this in order that the WinGet package deal dependencies will not be downloaded.
- -Supply Use this to specify the supply location
- -Model Specify the model of the WinGet package deal to be downloaded
For instance:
This exported Notepad++ to my Downloads folder:
Subsequent to the set up file, there’s additionally the corresponding .yaml file that WinGet makes use of:
Discover-WinGetPackage
You should use this to seek for packages from the configured sources. Parameters are:
- -Command Specify the title of the command within the package deal manifest.
- -Rely: Use this to specify the utmost variety of outcomes to return.
- -Id You possibly can specify the WinGet package deal identifier, comparable to Notepad++.Notepad++
- -MatchOption This specifies the match choice when querying packages. Values are Equals, EqualsCaseInsentitive, StartWithCaseInsensitive, ContainsCaseSensitive
- -Moniker Specify the moniker of the WinGet package deal to obtain. For instance, the moniker for the Microsoft.PowerShell package deal is
pwsh
- -Title Specify the title of the WinGet package deal to seek for
- -Supply Use this to specify the supply location. Acquainted sources are msstore and winget
- -Tag Specify a package deal tag to seek for
For instance:
Get-WinGetPackage
This may checklist all of the packages put in in your system from WinGet sources and different strategies. Packages put in utilizing MSIX or ARP can’t be correlated to WinGet. Parameters are:
- -Command Specify the title of the command within the package deal manifest.
- -Rely: Use this to specify the utmost variety of outcomes to return.
- -Id You possibly can specify the WinGet package deal identifier, comparable to Notepad++.Notepad++
- -MatchOption This specifies the match choice when querying packages. Values are Equals, EqualsCaseInsentitive, StartWithCaseInsensitive, ContainsCaseSensitive
- -Moniker Specify the moniker of the WinGet package deal to obtain. For instance, the moniker for the Microsoft.PowerShell package deal is
pwsh
- -Title Specify the title of the WinGet package deal to seek for
- -Supply Use this to specify the supply location. Acquainted sources are msstore and winget
- -Tag Specify a package deal tag to seek for
For instance (The checklist is so much longer 😀 )
Get-WinGetSetting
This may retrieve all of the configured WinGet settings, together with the schema, administrative settings, and the placement of the consumer settings file. For instance:
It has one Parameter, -AsPlainText. This may output the ends in a JSON format like:
{"$schema":"https://aka.ms/winget-settings-export.schema.json","adminSettings":{"BypassCertificatePinningForMicrosoftStore":false,"InstallerHashOverride":false,"LocalArchiveMalwareScanOverride":false,"LocalManifestFiles":false,"ProxyCommandLineOptions":false},"userSettingsFile":"C:CustomersHarmVeenstraAppDataNativePackagesMicrosoft.DesktopAppInstaller_8wekyb3d8bbweLocalStatesettings.json"}
Get-WinGetSource
This may show all of the configured WinGet Sources. The -Title Parameter can be utilized to specify a particular title. For instance:
Get-WinGetUserSettings
This may show the WinGet settings for the present consumer; by default, these are saved in $env:LOCALAPPDATAPackagesMicrosoft.DesktopAppInstaller_8wekyb3d8bbweLocalStatesettings.json (This file might be created after setting the primary choice utilizing Set-WinGetUserSetting)
For instance:
This reveals my consumer settings through which I configured the progress bar to point out in a rainbow coloration scheme.
Get-WinGetVersion
This may present the put in model of WinGet. For instance:
Set up-WinGetPackage
This may set up a WinGet package deal from a configured supply. Parameters are:
- -AllowHashMismatch Lets you obtain a package deal even when the SHA256 hash for an installer or a dependency doesn’t match the SHA256 hash within the WinGet package deal manifest.
- -Structure You possibly can specify the processor structure for the WinGet package deal installer. The values are Arm, Arm64, Default, X64, or X86.
- -Customized This will cross extra arguments to the installer in a single string worth.
- -Pressure Pressure the installer to run even when different checks WinGet would carry out would forestall this motion.
- -Id Specify the package deal identifier for which to look. The command does a case-insensitive full-text match quite than a substring match.
- -InstallerType Use this to specify the kind. Values are: Default, Inno, Wix, Msi, Nullsoft, Zip, Msix, Exe, Burn, MSStore and Moveable
- -Locale Use this to specify the locale. For instance, en-US of nl-NL.
- -Log Specify the placement for the installer log. The worth is usually a fully-qualified or relative path and should embrace the file title. For instance:
$env:TEMPpackage.log
. - -MatchOption This specifies the match choice when querying packages. Values are Equals, EqualsCaseInsentitive, StartWithCaseInsensitive, ContainsCaseSensitive.
- -Mode Specify the installer’s output mode. Values are silent or interactive
- -Moniker Specify the moniker of the WinGet package deal to obtain. For instance, the moniker for the Microsoft.PowerShell package deal is
pwsh
- -Title Specify the title of the WinGet package deal to be put in.
- -PSCatalogPackage Present PSCatalogPackage object. You may get a PSCatalogPackage object by utilizing the
Discover-WinGetPackage
command. - -Scope Specify the WinGet package deal installer scope. Values are Any, Consumer, System, UserOrUnknown, SystemOrUnkown
- -SkipDependencies Use this in order that the WinGet package deal dependencies will not be downloaded.
- -Supply Use this to specify the supply location
- -Model Specify the model of the WinGet package deal to be downloaded.
For instance, if you wish to set up Whole Commander, you’ll be able to run “Set up-WinGetPackage -Id Ghisler.TotalCommander -Mode Silent“
Take away-WinGetSource
This may take away a configured WinGet Supply; by default, two sources are registered: msstore and winget. It should be run as an Administrator; the -Title is the one parameter. For instance:
Restore-WinGetPackage
This may restore a WinGet package deal set up in your laptop if the package deal helps that. Parameters are:
- -Id Specify the package deal identifier for which to look. The command does a case-insensitive full-text match quite than a substring match.
- -Log Specify the placement for the installer log. The worth is usually a fully-qualified or relative path and should embrace the file title. For instance:
$env:TEMPpackage.log
. - -MatchOption This specifies the match choice when querying packages. Values are Equals, EqualsCaseInsentitive, StartWithCaseInsensitive, ContainsCaseSensitive.
- -Mode Specify the installer’s output mode. Values are silent or interactive
- -Moniker Specify the moniker of the WinGet package deal to obtain. For instance, the moniker for the Microsoft.PowerShell package deal is
pwsh
. - -Title Specify the title of the WinGet package deal to be put in.
- -PSCatalogPackage Present PSCatalogPackage object. You may get a PSCatalogPackage object by utilizing the
Discover-WinGetPackage
command. - -Supply Use this to specify the supply location
- -Model Specify the model of the WinGet package deal that must be repaired.
For instance:
It doesn’t all the time assist uninstall, or it may fail. Your mileage would possibly fluctuate 🙂
Restore-WinGetPackager
This may restore an current set up of WinGet or set up it in your system if not already current, and this can be a nice strategy to set up it in your Home windows Sandbox set up 🙂 Parameters are:
- -AllUsers Use this parameter to restore the WinGet consumer for all consumer accounts on the pc. The command should be run with administrator permissions.
- -IncludePreRelease Use this parameter to incorporate prerelease variations of the WinGet consumer.
- -Newest Use this parameter to put in the most recent model of the WinGet consumer.
- -Model Use this parameter to specify the particular model of the WinGet consumer to put in.
For instance, that is the output after I ran it in a Home windows Sandbox VM that didn’t have WinGet put in:
It downloads all of the set up recordsdata and installs them, and the WinGet consumer is on the market to be used, and all of the cmdlets will work now, too:
Reset-WinGetSource
This may reset a WinGet supply by eradicating it from the supply configuration. The Parameters are:
- -All This may reset all sources and add the default sources (msstore and winget).
- -Title You possibly can specify a particular one right here.
For instance, to reset the WinGet supply, you’ll be able to run Reset-WinGetSource -Title winget -Verbose (I added -Verbose as a result of it received’t return any data if profitable)
Set-WinGetUserSetting
You should use this to configure consumer settings for WinGet, that are saved in $env:LOCALAPPDATAPackagesMicrosoft.DesktopAppInstaller_8wekyb3d8bbweLocalStatesettings.json (This file might be created after setting the primary choice utilizing Set-WinGetUserSetting). Parameters are:
- -Merge By default, the command overwrites the present setting with the values supplied. Use this parameter to append the brand new settings to the present configuration.
- -UserSettings A hashtable containing the key-value pairs representing the WinGet settings
The accessible settings are documented right here: https://github.com/microsoft/winget-cli/blob/grasp/doc/Settings.md
For instance, as talked about within the Get-WinGetUserSetting chapter, you’ll be able to configure the progress bar to be in a rainbow coloration scheme like this:
Check-WinGetUserSetting
This may assist you to take a look at if a particular setting is energetic in WinGet consumer settings. Parameters are:
- -IgnoreNotSet While you use the IgnoreNotSet parameter, the command solely checks the supplied values and doesn’t embrace different WinGet settings within the comparability.
- -UserSettings A hashtable containing the key-value pairs representing the WinGet settings.
For instance, to check the rainbow coloration scheme, you’ll use this:
Uninstall-WinGetPackage
You should use this to uninstall a package deal that was put in utilizing WinGet. Parameters are:
- -Id Specify the package deal identifier for which to look. The command does a case-insensitive full-text match quite than a substring match.
- -Log Specify the placement for the installer log. The worth is usually a fully-qualified or relative path and should embrace the file title. For instance:
$env:TEMPpackage.log
. - -MatchOption This specifies the match choice when querying packages. Values are Equals, EqualsCaseInsentitive, StartWithCaseInsensitive, ContainsCaseSensitive.
- -Mode Specify the installer’s output mode. Values are default, silent, or interactive
- -Moniker Specify the moniker of the WinGet package deal to obtain. For instance, the moniker for the Microsoft.PowerShell package deal is
pwsh
. - -Title Specify the title of the WinGet package deal that must be uninstalled.
- -PSCatalogPackage Present PSCatalogPackage object. You may get a PSCatalogPackage object by utilizing the
Discover-WinGetPackage
command. - -Supply Use this to specify the supply location
- -Model Specify the model of the WinGet package deal that must be uninstalled.
For instance, uninstalling Whole Commander would appear like this:
I did use the Silent choice, nevertheless it nonetheless prompted me for uninstallation (If I wished to maintain configuration recordsdata, for instance)
Replace-WinGetPackage
This may replace the WinGet software program put in in your laptop. Parameters are:
- -AllowHashMismatch Lets you obtain a package deal even when the SHA256 hash for an installer or a dependency doesn’t match the SHA256 hash within the WinGet package deal manifest.
- -Structure You possibly can specify the processor structure for the WinGet package deal installer. The values are Arm, Arm64, Default, X64, or X86.
- -Customized This will cross extra arguments to the installer in a single string worth.
- -Pressure Pressure the installer to run even when different checks WinGet would carry out would forestall this motion.
- -Id Specify the package deal identifier for which to look. The command does a case-insensitive full-text match quite than a substring match.
- -IncludeUnknown Use this parameter to improve the package deal when the put in model shouldn’t be specified within the registry
- -InstallerType Use this to specify the kind. Values are: Default, Inno, Wix, Msi, Nullsoft, Zip, Msix, Exe, Burn, MSStore and Moveable
- -Locale Use this to specify the locale. For instance, en-US of nl-NL.
- -Location Specify the file path the place you need the packed put in. The installer should have the ability to assist alternate set up areas.
- -Log Specify the placement for the installer log. The worth is usually a fully-qualified or relative path and should embrace the file title. For instance:
$env:TEMPpackage.log
. - -MatchOption This specifies the match choice when querying packages. Values are Equals, EqualsCaseInsentitive, StartWithCaseInsensitive, ContainsCaseSensitive.
- -Mode Specify the output mode for the installer; values are default, silent, and interactive.
- -Moniker Specify the moniker of the WinGet package deal to obtain. For instance, the moniker for the Microsoft.PowerShell package deal is
pwsh
- -Title Specify the title of the WinGet package deal to be put in.
- -Override Use this parameter to override the present arguments handed on to the installer. The parameter takes a single string worth. So as to add a number of arguments, embrace the arguments within the string. The arguments should be supplied within the format anticipated by the installer
- -PSCatalogPackage Present PSCatalogPackage object. You may get a PSCatalogPackage object by utilizing the
Discover-WinGetPackage
command. - -Scope Specify the WinGet package deal installer scope. Values are Any, Consumer, System, UserOrUnknown, SystemOrUnkown
- -SkipDependencies Use this in order that the WinGet package deal dependencies will not be downloaded.
- -Supply Use this to specify the supply location
- -Model Specify the model of the WinGet package deal to be downloaded.
You should use Get-WinGetPackage and Replace-WinGetPackage, for instance, collectively to replace all WinGet-installed software program like this: Get-WinGetPackage | The place-Object Supply -eq winget | Replace-WinGetPackage. This may appear like:
As you’ll be able to see within the Standing column, Git was up to date efficiently, Groups had an set up error (System-Extensive installer for Groups Basic), and the others had no relevant improve.
Wrapping up
Within the weblog put up, I confirmed all of the cmdlets from the Microsoft WinGet.Consumer PowerShell module. It has dramatically improved since my weblog put up in regards to the Preview model in 2023. I like the Restore-WinGetPackageManager cmdlet; it makes putting in WinGet on a system a lot simpler!