powershellnugetwinget

Cannot install winget as normal user from powershell : winget is not installed in $env:localappdata/microsoft/WindowsApps/


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>

Solution