Trying to install winget as a non-admin user from powershell.
Here is what I did :
I first installed NuGet (because Winget said it needs it) :
PS D:\Users\test> Install-PackageProvider -Name NuGet -Scope CurrentUser The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'https://onegetcdn.azureedge.net/providers/nuget-2.8.5.208.package.swidtag'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
Name Version Source Summary
---- ------- ------ -------
nuget 2.8.5.208 https://onege... NuGet provider for the OneGet meta-package manager
PS D:\Users\test>
Than I installed winget :
PS D:\Users\test> Install-Module -Name Microsoft.WinGet.Client -Scope CurrentUser
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the
Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
PS D:\Users\test>
But the $env:localappdata/microsoft/WindowsApps/ directory is not even there and therefore Winget is not installed into it :
PS D:\Users\test> winget -v
winget : The term 'winget' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
+ winget -v
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (winget:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS D:\Users\test> ls $env:localappdata/microsoft/WindowsApps/
ls : Cannot find path 'D:\Users\test\AppData\Local\microsoft\WindowsApps\' because it does not exist.
At line:1 char:1
+ ls $env:localappdata/microsoft/WindowsApps/
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (D:\Users\test.m...ft\WindowsApps\:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
PS D:\Users\test>
The Microsoft.WinGet.Client
module does not contain winget.exe
, the Windows Package Manager CLI.
It is meant to be a PowerShell-friendly alternative to winget.exe
, providing cmdlets, such as Install-WinGetPackage
.
Caveat: As of v1.6.3133.0 of this module and PowerShell (Core) 7.4.0, the module is broken, and I am unclear on its maintenance status.
Generally, PowerShell modules do not ship with executables, and their installation locations are known to PowerShell only, and are unrelated to the lookup mechanism used by the system for executables via the PATH
environment variables.
winget.exe
should be preinstalled on Windows 11 and recent versions of Windows 10.
On older versions / machines where winget.exe
was removed you may be able to (re-)install it on demand:
Interactively: via the Microsoft Store, where it comes with the App Installer package.
Programmatically: via the instructions provided here.
Add-AppxPackage
to install the package for the current user only. If you want to install for all users, use Add-AppxProvisionedPackage
instead (requires elevation; use with -Online
).For a given user, winget.exe
should (then) be available via the "$env:LOCALAPPDATA\Microsoft\WindowsApps"
directory, which should be an entry in the PATH
environment variable ($env:PATH
). Verify its availability and version number by running winget.exe --version