Program 'winget.exe' failed to run: Access is denied
Brief description of your issue
Issue facing :
Program 'winget.exe' failed to run: Access is denied at
we are trying to install using "winget install -e --id $PackageId --source winget"
where as winget is present at 2 different location :
- C:\Users\user_name\AppData\Local\Microsoft\WindowsApps 2)C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.26.400.0_x64__8wekyb3d8bbwe
winget version: v1.11.400 windows details : Edition Windows 11 Enterprise Version 23H2 OS build 22631.4169
Steps to reproduce
we are trying to install using "winget install -e --id $PackageId --source winget"
Expected behavior
Winget should work
Actual behavior
Winget command should work .
Environment
Windows Package Manager v1.11.400
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.22631.4169
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.26.400.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
Installer Downloads %USERPROFILE%\Downloads
Configuration Modules %LOCALAPPDATA%\Microsoft\WinGet\Configuration\Modules
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
ProxyCommandLineOptions Disabled
DefaultProxy Disabled
since this is an Enterprise edition of Windows i think you might have some policy defined (via Active Directory local domain / Azure AD or similar) that enables AppLocker / Software restriction policies
to check: start mmc.exe (it wil ask for admin elevation) then under the File menu, add the snap-in for Resultant Set of Policies. then check there what policies are enabled for the machine. (hint: right click -> Generate RSoP data)
first place to look at is under Computer Configuration -> Windows settings -> Security settings -> Software Restriction Policies but there might be other places too where execution restrictions can be defined https://learn.microsoft.com/windows/security/application-security/application-control/app-control-for-business/
I have the same problem. It happens only when I connect using ssh (even from the same desktop).
It works fine when I am running winget directly.
Until recently I was able to run winget on a windows 11 openssh service session.
But now I am getting:
❯ 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
❯ cmd
Microsoft Windows [Version 10.0.26200.6901]
(c) Microsoft Corporation. All rights reserved.
>winget
Access is denied.
This seems like a ssh server problem. It also happens when git runs under ssh and calls the windows ssh client.