Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DSC] Could not find PowerShell module Microsoft.PowerToys.Configure #33744

Closed
loicreynier opened this issue Jul 9, 2024 · 3 comments
Closed
Labels
Area-Setup/Install Refers to installation mechanism Issue-Bug Something isn't working Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@loicreynier
Copy link

loicreynier commented Jul 9, 2024

Microsoft PowerToys version

0.82.0

Installation method

WinGet

Running as admin

Yes

Area(s) with issue?

General

Steps to reproduce

winget configure --file <file> --open-logs --verbose-logs where <file> is one of the example files such as

# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
  resources:
    - resource: Microsoft.WinGet.DSC/WinGetPackage
      id: installPowerToys
      directives:
        description: Install PowerToys
        allowPrerelease: true
      settings:
        id: Microsoft.PowerToys
        source: winget

    - resource: Microsoft.PowerToys.Configure/PowerToysConfigure
      dependsOn:
        - installPowerToys
      directives:
        description: Configure PowerToys
      settings:
        ShortcutGuide:
          Enabled: false
          OverlayOpacity: 50
        FancyZones:
          Enabled: true
          FancyzonesEditorHotkey: "Shift+Ctrl+Alt+F"
        FileLocksmith:
          Enabled: false
  configurationVersion: 0.2.0

✔️ Expected Behavior

Installation and configuration should work fine.

❌ Actual Behavior

I got an error applying the second resource "PowerToysConfigure":

Apply :: WinGetPackage [installPowerToys]
  Configuration successfully applied.
Apply :: PowerToysConfigure
  The configuration unit could not be found.
Some of the configuration was not applied successfully.

Taking a look at the logs:

2024-07-09 17:47:12.113 [CONF] Creating unit processor for: Microsoft.PowerToys.Configure/PowerToysConfigure...
2024-07-09 17:47:12.451 [CONF] PowerShellCommands: ['Find-Module' Parameters: Name = 'Microsoft.PowerToys.Configure' ]
[WriteError] No match was found for the specified search criteria and module name 'Microsoft.PowerToys.Configure'. Try Get-PSRepository to see all available registered module repositories.

2024-07-09 17:47:12.452 [CONF] Microsoft.Management.Configuration.Processor.Exceptions.FindDscResourceNotFoundException: Could not find resource: PowerToysConfigure [Microsoft.PowerToys.Configure]
   at Microsoft.Management.Configuration.Processor.Set.ConfigurationSetProcessor.PrepareUnitForProcessing(ConfigurationUnitInternal unitInternal)
   at Microsoft.Management.Configuration.Processor.Set.ConfigurationSetProcessor.CreateUnitProcessor(ConfigurationUnit incomingUnit)
2024-07-09 17:47:12.474 [CONF] Configuration unit PowerToysConfigure[] failed with code 0x8a15c102 and error message:
The text associated with this error code could not be found.

2024-07-09 17:47:12.474 [CLI ] Terminating context: 0x8a15c005 at C:\__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\ConfigurationFlow.cpp:560

It looks like the Microsoft.PowerToys.Configure module could not be found.
However it is installed in Documents/Powershell/Modules/Microsoft.PowerToys.Configure/v0.82.0. Also I tried to copy it to both Document/WindowsPowershell/Modules and Programs Files/WindowsPowerShell/Modules and it is still not found.

On the other side, the module cannot be imported from PowerShell either:

Find-Module Microsoft.PowerToys.Configure
# Find-Package: No match was found for the specified search criteria and module name 'Microsoft.PowerToys.Configure'.

I have tried reinstalling PowerToys v0.82 from WinGet and from PowerToys updates and still got this error.

Also, importing the module manually does not work either:

Import-Module -Verbose -Name C:\Users\Loic\Documents\Powershell\Modules\Microsoft.PowerToys.Configure\v0.82.0\
# Import-Module: The specified module C:\Users\Loic\Documents\Powershell\Modules\Microsoft.PowerToys.Configure\v0.82.0\' was not loaded because no valid module file was found in any module directory.

Other Software

PowerShell 7.4.3
WindowsPowerShell 5.1.22621.3672

@loicreynier loicreynier added Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Jul 9, 2024
@loicreynier
Copy link
Author

I think I found the issue. Both the WinGet installation and the per-user setup provided in the releases install the module in Modules/v0.82.0 instead of Modules/0.82.0 (as done by the machine setup). The first one is not detected by PowerShell.

@loicreynier loicreynier changed the title DSC: Could not find Microsoft.PowerToys.Configure [DSC] Could not find PowerShell module Microsoft.PowerToys.Configure Jul 9, 2024
@denelon
Copy link

denelon commented Jul 10, 2024

WinGet would likely default to searching for the module in the PSGallery if it's not where WinGet expects it to be. There might be another simple fix, but I think that's what is happening on the WinGet side of things.

@htcfreek htcfreek added Area-Setup/Install Refers to installation mechanism Status-In progress This issue or work-item is under development labels Jul 11, 2024
@jaimecbernardo jaimecbernardo added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Status-In progress This issue or work-item is under development Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Jul 11, 2024
@loicreynier
Copy link
Author

Closed by #33782.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Setup/Install Refers to installation mechanism Issue-Bug Something isn't working Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

No branches or pull requests

4 participants