microsoft / microsoft/winget-cli

Winget not working from PowerShell window elevated using Intune EPM

Open
#3,418 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Bug PowerShell
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Brief description of your issue

I am running Powershell as Admin, which I launched by using Intune Endpoint Privilege Manager (EPM). I am trying to run winget and it is not working.

Steps to reproduce

I open a Powershell Administrator session, by using the 'Run with Elevated Access' feature of Intune EPM

Intune EPM

When I then run winget.exe it gives an error

Expected behavior

winget runs normally, with Administrator privilege (because it was run with an elevated PowerShell session) and allows me to install/manage packages

Actual behavior

When I then try to run winget.exe it fails; when I first try to run it is unable to recognize the cmdlet. When I change to the location of winget.exe the error is different.

unable to recognize the cmdlet

PS C:\Windows\System32\WindowsPowerShell\v1.0> winget
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
  •   + CategoryInfo          : ObjectNotFound: (winget:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

PS C:\Windows\System32\WindowsPowerShell\v1.0>

When I change to the path where winget.exe is located, I get an access denied / NativeCommandFailed error:

PS C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.20.1572.0_x64__8wekyb3d8bbwe> .\winget
Program 'winget.exe' failed to run: Access is deniedAt line:1 char:1

  • .\winget

At line:1 char:1

  • .\winget
  •   + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
      + FullyQualifiedErrorId : NativeCommandFailed
    
    

PS C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.20.1572.0_x64__8wekyb3d8bbwe>

Environment
PS C:\Users\118258> winget --info
Windows Package Manager v1.5.1572
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22000.2057
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.20.1572.0

Winget Directories
-----------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Diag…
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\sett…
Portable Links Directory (User)    %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User)       %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root              C:\Program Files\WinGet\Packages
Portable Package Root (x86)        C:\Program Files (x86)\WinGet\Packages

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Admin Setting                             State
--------------------------------------------------
LocalManifestFiles                        Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled
PS C:\Users\118258>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported failure in an elevated PowerShell session launched through Intune Endpoint Privilege Manager, first from the normal prompt and then from the directory containing winget.exe. Compare the command-resolution and access-denied behavior with a standard administrative PowerShell session; done means winget runs and can install or manage packages in the EPM-launched session.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.