Skip to content

Winget doesn't work when run from elevated cmd #2443

Closed

Description

@koniu80

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.

Activity

  1. ghost added
    Needs-Triage
    on Aug 11, 2022
  2. added
    Issue-Bug
    and removed
    Needs-Triage
    on Aug 11, 2022
  3. denelon commented on Aug 11, 2022

    @denelon
    Collaborator

    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.

  4. added
    Needs-Author-Feedback
    on Aug 11, 2022
  5. koniu80 commented on Aug 12, 2022

    @koniu80
    Author

    Hi,

    See below. No change

    image

  6. ghost added
    Needs-Attention
    on Aug 12, 2022
  7. ghost removed
    Needs-Author-Feedback
    on Aug 12, 2022
  8. mark-eagles commented on Oct 21, 2022

    @mark-eagles

    Getting same issue from Administrator command prompt on Win 10:

    image

  9. mark-eagles commented on Oct 21, 2022

    @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;

  10. Bognar commented on Nov 27, 2022

    @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.

  11. xillibit commented on Mar 9, 2023

    @xillibit

    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

  12. modified the milestones: v1.5-Client, on Apr 18, 2023
  13. modified the milestones: , 1.9 Client on Jul 9, 2024
  14. removed
    Needs-Attention
    on Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions