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.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
winget search pgAdmin

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 search pgAdmin
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (winget:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

$env:Path

C:\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
2
3
4
5
6
7
8
$env:Path += ";C:\Users\you\AppData\Local\Microsoft\WindowsApps"

winget search pgAdmin

Name      Id                 Version Source
-----------------------------------------------
pgAdmin 4 PostgreSQL.pgAdmin 8.4     winget
PS C:\Users\ama> winget install pgAdmin

Share


See also