Making winget Usable from PowerShell as a Normal User


Posted on Sun, Mar 10, 2024
Tags powershell, windows
powershell, windows
📝 This article is a translation of the original Japanese post. View original

winget Is Somehow Not Found When PowerShell Is Launched as a Normal User

The cause is simple: the location of winget is not in the Path. Why it ends up that way is unclear, though. Since winget is a Microsoft tool, you would expect the path to be set up from the start.

 1winget search pgAdmin
 2
 3winget : The term 'winget' is not recognized as the name of a cmdlet, function, script file, or operable program.
 4Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
 5At line:1 char:1
 6+ winget search pgAdmin
 7+ ~~~~~~
 8    + CategoryInfo          : ObjectNotFound: (winget:String) [], CommandNotFoundException
 9    + FullyQualifiedErrorId : CommandNotFoundException
10
11$env:Path
12
13C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Docker\Docker\resources\bin;

winget lives under C:\Users\you\AppData\Local\Microsoft\WindowsApps, so add that to the path.

1$env:Path += ";C:\Users\you\AppData\Local\Microsoft\WindowsApps"
2
3winget search pgAdmin
4
5Name      Id                 Version Source
6-----------------------------------------------
7pgAdmin 4 PostgreSQL.pgAdmin 8.4     winget
8PS C:\Users\ama> winget install pgAdmin

Share


See also