microsoft / microsoft/winget-cli

winget configure with Registry resource unable to write to HKLM:\SOFTWARE\### from admin shell

Open
#3,996 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Brief description of your issue

Running from an administrator "cmd" prompt I am trying to use "winget configure" to apply the following:

properties:
  resources:
    - resource: Registry
      directives:
        description: add
      settings:
        Key: 'HKLM:\SOFTWARE\XYZ'
        Ensure: 'Present'
        ValueName: ''
        ValueType: 'String'
        ValueData: ''
        Force: 1
  configurationVersion: 0.2.0

I get

Apply :: Registry
The configuration unit failed while attempting to apply the desired state.
Exception calling "OpenSubKey" with "2" argument(s): "Requested registry access is not allowed."

It's only an issue creating Key directly under SOFTWARE. Again I am running from Administrator shell. Is Winget running as some other user

Steps to reproduce
  • Open cmd shell as Administrator
  • winget configure -f
Expected behavior

Registry key should be created as expected since I'm Administrator

Actual behavior

Registry key not created and error says "Requested registry access is not allowed"

Environment
Windows Package Manager (Preview) v1.7.2491-preview
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22621.2861
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.22.2491.0

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 issue with the supplied configuration file from an Administrator cmd shell using winget configure, then inspect the configuration log referenced in the error. Trace the Registry resource handling for HKLM:\SOFTWARE\XYZ and compare it with a writable registry path. Done means the configuration creates the requested key without the access-denied error.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.