winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

Winget doesn't work when run from elevated cmd

Open koniu80 opened this issue 3 years ago • 4 comments

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

image

image

Source update doesn't make any difference

image

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.

koniu80 avatar Aug 11 '22 07:08 koniu80

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.

denelon avatar Aug 11 '22 17:08 denelon

Hi,

See below. No change

image

koniu80 avatar Aug 12 '22 07:08 koniu80

Getting same issue from Administrator command prompt on Win 10:

image

mark-eagles avatar Oct 21 '22 14:10 mark-eagles

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;

mark-eagles avatar Oct 21 '22 15:10 mark-eagles

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.

Bognar avatar Nov 27 '22 00:11 Bognar

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

xillibit avatar Mar 09 '23 19:03 xillibit