Winget doesn't work when run from elevated cmd
Brief description of your issue
Winget works fine from non-elevated cmd. From elevated cmd it gives "Failed when searching source; results will not be included: winget" error on almost every command
Expected behavior
Expected to be able to use winget on elevated prompt without the need to enter admin password to install software
Actual behavior
If I run exactly same command on elevated and non-elevated prompts I get different behaviours


Source update doesn't make any difference

Comment
I think I have read though all the solutions I could find, most of them point to the issue with PATH, but in my case I can run the software, but it doesn't work as expected. Please advise.
Which version of winget is this?
The output from winget --info helps to troubleshoot.
Does winget run in administrator mode from "C:\Users\Administrator>"?
Try running winget source reset --force in the administrator prompt.
Hi,
See below. No change

Getting same issue from Administrator command prompt on Win 10:

The following fixed this issue for me (running from admin powershell), I installed the Microsoft.Winget.Source app with the following:
Invoke-WebRequest 'https://cdn.winget.microsoft.com/cache/source.msix' -OutFile 'c:\downloads\Microsoft.Winget.Source.msix' -UseBasicParsing
Push-Location 'c:\downloads'; Add-AppxPackage -Path 'Microsoft.Winget.Source.msix'; Pop-Location;
I am having the same issue; I can run as local user but not as admin from cmd and PowerShell. The invoke command from above did not help in my case.
I am having the same issue; I can run as local user but not as admin from cmd and PowerShell. The invoke command from above did not help in my case.
For me it's fixed in 1.5.441-preview