winget. Error: (5) Access is denied. Topic is solved

Report problems with documented functionality
XMCQCX
Posts: 258
Joined: 14 Oct 2020, 23:44

winget. Error: (5) Access is denied.

Post by XMCQCX » 20 Jun 2023, 21:05

Hi,
I execute this PowerShell command to update all apps on my system:

Code: Select all

winget upgrade --all
Today, on 2023-06-20 at 09:57, I encountered an error while ahk was attempting to update from version 2.0.2 to 2.0.3.
Attachments
2023-06-20 21_50_47-Windows_PowerShell.png
2023-06-20 21_50_47-Windows_PowerShell.png (99.35 KiB) Viewed 1456 times
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: winget. Error: (5) Access is denied.

Post by lexikos » 21 Jun 2023, 01:57

At the moment, I have no interest in trying to work out exactly what winget is doing. If someone can reproduce this error by running setup directly at the command line, I would be more interested in looking into it.
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: winget. Error: (5) Access is denied.

Post by jNizM » 25 Jun 2023, 06:53

Image

Code: Select all

*#1 (1452) : [DirCreate] DirCreate(dir := installDir "\.staging\" A_ScriptName)
*#1 (1452) : [UnpackFiles] DirCreate(dir := installDir "\.staging\" A_ScriptName)
*#1 (473) : [Installation.Prototype.ResolveSourceDir] this.SourceDir := UnpackFiles(this.InstallDir)
*#1 (532) : [Installation.Prototype.InstallFull] this.ResolveSourceDir()
*#1 (412) : [Install_Main] inst.%method%(params*)
*#1 (1188) : [] Install_Main()
> Auto-execute

But works flawless with elevated privileges
(cmd as admin: silent parameter or with winget)
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: winget. Error: (5) Access is denied.

Post by lexikos » 25 Jun 2023, 22:59

Perhaps it is defaulting to Program Files. It is not supposed to do that unless it is running as administrator. I will debug later.
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: winget. Error: (5) Access is denied.  Topic is solved

Post by lexikos » 08 Jul 2023, 02:19

As far as I can tell, this only happens when all of the following conditions are met:
  • There is an "all users" installation under HKLM.
  • There is no "current user" installation under HKCU.
  • You are not running as admin.
  • You did not specify the installation directory.
In other words,
  • You originally installed AutoHotkey as admin.
  • You are now trying to install AutoHotkey without admin privileges.
If you go through the same steps that you did to install it in the first place, you should get a positive result.

v2.0.4 prompts for elevation under these conditions, allowing the existing installation to be updated, which is most likely the desired result. However, it would have been equally valid to simply install in the default non-admin location, or perhaps even more correct if /silent can be construed as a request to suppress all prompts.
Post Reply

Return to “Bug Reports”