Skip to content

dsc resource list with --adapter flag returns with Exit code 1 #714

@lescx

Description

@lescx

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Summary

I am completely new to DSC and pretty new to Windows so please be kind if I'm missing something pretty obvious. I try my best.

Following the PowerShell team Getting Started devblog post, I'm experiencing the following issue:

dsc resource list --adapter Microsoft.Windows/WindowsPowerShell

2025-03-19T18:48:53.191333Z  WARN Command: Resource 'powershell' [Exit code 1] manifest description: Error

Type  Kind  Version  Caps  RequireAdapter  Description
------------------------------------------------------

I saw the error message with pwsh instead of powershell in #639 which links to #539

I'm working on a freshly installed Windows 11 Enterprise VM with DSC installed via winget:

winget list --id microsoft.dsc.preview

Name                              Id                    Version  Source
------------------------------------------------------------------------
DesiredStateConfiguration-Preview Microsoft.DSC.Preview 3.0.12.0 winget

I saw the same issue on the stable release but switched to the preview version to see if it has been fixed.

Get-ExecutionPolicy

RemoteSigned

Recursively calling Unblock-File did not seem to help me here:

PS C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe> Get-ChildItem -Recurse -File -Path .\psDscAdapter | Unblock-File

PS C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe> dsc resource list --adapter Microsoft.Windows/WindowsPowerShell
2025-03-19T19:03:30.991589Z  WARN Command: Resource 'powershell' [Exit code 1] manifest description: Error

Type  Kind  Version  Caps  RequireAdapter  Description
------------------------------------------------------

Not sure if this would be even required. Am I missing something?

Steps to reproduce

dsc --trace-level trace resource list --adapter Microsoft.Windows/WindowsPowerShell

2025-03-19T18:56:43.985507Z  INFO dsc::util: 416: Trace-level is Trace
2025-03-19T18:56:43.986206Z DEBUG dsc: 38: Running dsc 3.0.0-preview.12
2025-03-19T18:56:43.986822Z TRACE dsc_lib::discovery::command_discovery: 362: Listing resources with type_name_filter '*' and adapter_name_filter 'Microsoft.Windows/WindowsPowerShell'
2025-03-19T18:56:43.987211Z  INFO dsc_lib::discovery::command_discovery: 170: Discovering resources using filter: *
2025-03-19T18:56:43.987598Z DEBUG dsc_lib::discovery::command_discovery: 173: Using regex ^.*?$ as filter for adapter name
2025-03-19T18:56:43.991386Z DEBUG dsc_lib::util: 88: Found setting 'resourcePath' in C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\dsc_default.settings.json
2025-03-19T18:56:43.993291Z DEBUG dsc_lib::util: 98: Found setting 'resourcePath' in C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\dsc.settings.json
2025-03-19T18:56:43.993951Z DEBUG dsc_lib::util: 112: Did not find setting 'resourcePath' in C:\ProgramData\dsc\dsc.settings.json
2025-03-19T18:56:43.994635Z DEBUG dsc_lib::discovery::command_discovery: 119: Appending PATH to resourcePath
2025-03-19T18:56:43.995238Z TRACE dsc_lib::discovery::command_discovery: 122: Original PATH: "C:\\Program Files\\PowerShell\\7;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\PowerShell\\7\\;C:\\Users\\Desired Mage\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Desired Mage\\AppData\\Local\\Microsoft\\WinGet\\Packages\\Microsoft.DSC_Microsoft.Winget.Source_8wekyb3d8bbwe;C:\\Users\\Desired Mage\\AppData\\Local\\Programs\\Microsoft VS Code\\bin"
2025-03-19T18:56:43.995896Z TRACE dsc_lib::discovery::command_discovery: 143: Adding exe home to path: C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe
2025-03-19T18:56:43.996535Z DEBUG dsc_lib::discovery::command_discovery: 154: Using Resource Path: "C:\\Program Files\\PowerShell\\7;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Users\\Desired Mage\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Desired Mage\\AppData\\Local\\Microsoft\\WinGet\\Packages\\Microsoft.DSC_Microsoft.Winget.Source_8wekyb3d8bbwe;C:\\Users\\Desired Mage\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe"
2025-03-19T18:56:44.452688Z TRACE dsc_lib::discovery::command_discovery: 209: Found resource manifest: "C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\\assertion.dsc.resource.json"
2025-03-19T18:56:44.454712Z TRACE dsc_lib::discovery::command_discovery: 230: Resource 'Microsoft.DSC/Assertion' found
2025-03-19T18:56:44.469283Z TRACE dsc_lib::discovery::command_discovery: 209: Found resource manifest: "C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\\echo.dsc.resource.json"
2025-03-19T18:56:44.470817Z TRACE dsc_lib::discovery::command_discovery: 230: Resource 'Microsoft.DSC.Debug/Echo' found
2025-03-19T18:56:44.472464Z TRACE dsc_lib::discovery::command_discovery: 209: Found resource manifest: "C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\\group.dsc.resource.json"
2025-03-19T18:56:44.473862Z TRACE dsc_lib::discovery::command_discovery: 230: Resource 'Microsoft.DSC/Group' found
2025-03-19T18:56:44.474587Z TRACE dsc_lib::discovery::command_discovery: 209: Found resource manifest: "C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\\osinfo.dsc.resource.json"
2025-03-19T18:56:44.476528Z TRACE dsc_lib::discovery::command_discovery: 230: Resource 'Microsoft/OSInfo' found
2025-03-19T18:56:44.477754Z TRACE dsc_lib::discovery::command_discovery: 209: Found resource manifest: "C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\\powershell.dsc.resource.json"
2025-03-19T18:56:44.478628Z TRACE dsc_lib::discovery::command_discovery: 227: Resource adapter 'Microsoft.DSC/PowerShell' found
2025-03-19T18:56:44.479412Z TRACE dsc_lib::discovery::command_discovery: 209: Found resource manifest: "C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\\reboot_pending.dsc.resource.json"
2025-03-19T18:56:44.480157Z TRACE dsc_lib::discovery::command_discovery: 230: Resource 'Microsoft.Windows/RebootPending' found
2025-03-19T18:56:44.481004Z TRACE dsc_lib::discovery::command_discovery: 209: Found resource manifest: "C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\\registry.dsc.resource.json"
2025-03-19T18:56:44.481779Z TRACE dsc_lib::discovery::command_discovery: 230: Resource 'Microsoft.Windows/Registry' found
2025-03-19T18:56:44.482751Z TRACE dsc_lib::discovery::command_discovery: 209: Found resource manifest: "C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\\RunCommandOnSet.dsc.resource.json"
2025-03-19T18:56:44.483390Z TRACE dsc_lib::discovery::command_discovery: 230: Resource 'Microsoft.DSC.Transitional/RunCommandOnSet' found
2025-03-19T18:56:44.484350Z TRACE dsc_lib::discovery::command_discovery: 209: Found resource manifest: "C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\\windowspowershell.dsc.resource.json"
2025-03-19T18:56:44.484940Z TRACE dsc_lib::discovery::command_discovery: 227: Resource adapter 'Microsoft.Windows/WindowsPowerShell' found
2025-03-19T18:56:44.485698Z TRACE dsc_lib::discovery::command_discovery: 209: Found resource manifest: "C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\\wmi.dsc.resource.json"
2025-03-19T18:56:44.486448Z TRACE dsc_lib::discovery::command_discovery: 227: Resource adapter 'Microsoft.Windows/WMI' found
2025-03-19T18:56:44.487771Z DEBUG dsc_lib::discovery::command_discovery: 241: Found 7 matching non-adapter-based resources
2025-03-19T18:56:44.497861Z DEBUG dsc_lib::discovery::command_discovery: 257: Using regex ^Microsoft\.Windows/WindowsPowerShell$ as filter for adapter name
2025-03-19T18:56:44.499218Z DEBUG dsc_lib::discovery::command_discovery: 265: Using regex ^.*?$ as filter for resource name
2025-03-19T18:56:44.500503Z  INFO dsc_lib::discovery::command_discovery: 289: Enumerating resources for adapter 'Microsoft.Windows/WindowsPowerShell'
2025-03-19T18:56:44.501834Z DEBUG dsc_lib::dscresources::command_resource: 663: Invoking command 'powershell' with args Some(["-NoLogo", "-NonInteractive", "-NoProfile", "-Command", "./psDscAdapter/powershell.resource.ps1 List"])
2025-03-19T18:56:45.511165Z TRACE dsc_lib::dscresources::command_resource: 871: PID 2360: ./psDscAdapter/powershell.resource.ps1 : File C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\psDscAdapter\powershell.resource.ps1 cannot be loaded because running scripts is disabled on this system. For more
2025-03-19T18:56:45.512496Z TRACE dsc_lib::dscresources::command_resource: 871: PID 2360: information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
2025-03-19T18:56:45.513326Z TRACE dsc_lib::dscresources::command_resource: 871: PID 2360: At line:1 char:1
2025-03-19T18:56:45.513788Z TRACE dsc_lib::dscresources::command_resource: 871: PID 2360: + ./psDscAdapter/powershell.resource.ps1 List
2025-03-19T18:56:45.514420Z TRACE dsc_lib::dscresources::command_resource: 871: PID 2360: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2025-03-19T18:56:45.515064Z TRACE dsc_lib::dscresources::command_resource: 871: PID 2360:     + CategoryInfo          : SecurityError: (:) [], PSSecurityException
2025-03-19T18:56:45.515651Z TRACE dsc_lib::dscresources::command_resource: 871: PID 2360:     + FullyQualifiedErrorId : UnauthorizedAccess
2025-03-19T18:56:45.542762Z DEBUG dsc_lib::dscresources::command_resource: 624: Process 'powershell' id 2360 exited with code 1
2025-03-19T18:56:45.544118Z  WARN dsc_lib::discovery::command_discovery: 314: Command: Resource 'powershell' [Exit code 1] manifest description: Error
2025-03-19T18:56:45.546756Z DEBUG dsc_lib::discovery::command_discovery: 661: Read 0 items into lookup table from "C:\\Users\\Desired Mage\\AppData\\Local\\dsc\\AdaptedResourcesLookupTable.json"

Expected behavior

dsc resource list --adapter Microsoft.Windows/WindowsPowerShell

Type                                                   Kind      Version   Caps      RequireAdapter                       Description
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PSDesiredStateConfiguration/Archive                    Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/Environment                Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/File                       Resource  1.0.0     gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/Group                      Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/GroupSet                   Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/Log                        Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/Package                    Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/ProcessSet                 Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/Registry                   Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/Script                     Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/Service                    Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/ServiceSet                 Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/SignatureValidation        Resource  1.0.0     gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/User                       Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/WaitForAll                 Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/WaitForAny                 Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/WaitForSome                Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/WindowsFeature             Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/WindowsFeatureSet          Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/WindowsOptionalFeature     Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/WindowsOptionalFeatureSet  Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/WindowsPackageCab          Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDesiredStateConfiguration/WindowsProcess             Resource  1.1       gs--t---  Microsoft.Windows/WindowsPowerShell
PSDscResources/Archive                                 Resource  2.12.0.0  gs--t---  Microsoft.Windows/WindowsPowerShell  This module contains the standard DSC resources.
PSDscResources/Environment                             Resource  2.12.0.0  gs--t---  Microsoft.Windows/WindowsPowerShell  This module contains the standard DSC resources.
PSDscResources/Group                                   Resource  2.12.0.0  gs--t---  Microsoft.Windows/WindowsPowerShell  This module contains the standard DSC resources.
PSDscResources/MsiPackage                              Resource  2.12.0.0  gs--t---  Microsoft.Windows/WindowsPowerShell  This module contains the standard DSC resources.
PSDscResources/Registry                                Resource  2.12.0.0  gs--t---  Microsoft.Windows/WindowsPowerShell  This module contains the standard DSC resources.
PSDscResources/Script                                  Resource  2.12.0.0  gs--t---  Microsoft.Windows/WindowsPowerShell  This module contains the standard DSC resources.
PSDscResources/Service                                 Resource  2.12.0.0  gs--t---  Microsoft.Windows/WindowsPowerShell  This module contains the standard DSC resources.
PSDscResources/User                                    Resource  2.12.0.0  gs--t---  Microsoft.Windows/WindowsPowerShell  This module contains the standard DSC resources.
PSDscResources/WindowsFeature                          Resource  2.12.0.0  gs--t---  Microsoft.Windows/WindowsPowerShell  This module contains the standard DSC resources.
PSDscResources/WindowsOptionalFeature                  Resource  2.12.0.0  gs--t---  Microsoft.Windows/WindowsPowerShell  This module contains the standard DSC resources.
PSDscResources/WindowsPackageCab                       Resource  2.12.0.0  gs--t---  Microsoft.Windows/WindowsPowerShell  This module contains the standard DSC resources.
PSDscResources/WindowsProcess                          Resource  2.12.0.0  gs--t---  Microsoft.Windows/WindowsPowerShell  This module contains the standard DSC resources.

Actual behavior

dsc --trace-level debug resource list --adapter Microsoft.Windows/WindowsPowerShell

2025-03-19T18:39:11.922427Z  INFO dsc::util: 416: Trace-level is Debug
2025-03-19T18:39:11.923154Z DEBUG dsc: 38: Running dsc 3.0.0-preview.12
2025-03-19T18:39:11.924180Z  INFO dsc_lib::discovery::command_discovery: 170: Discovering resources using filter: *
2025-03-19T18:39:11.926815Z DEBUG dsc_lib::discovery::command_discovery: 173: Using regex ^.*?$ as filter for adapter name
2025-03-19T18:39:11.928149Z DEBUG dsc_lib::util: 88: Found setting 'resourcePath' in C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\dsc_default.settings.json
2025-03-19T18:39:11.928869Z DEBUG dsc_lib::util: 98: Found setting 'resourcePath' in C:\Program Files\WindowsApps\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe\dsc.settings.json
2025-03-19T18:39:11.929948Z DEBUG dsc_lib::util: 112: Did not find setting 'resourcePath' in C:\ProgramData\dsc\dsc.settings.json
2025-03-19T18:39:11.930591Z DEBUG dsc_lib::discovery::command_discovery: 119: Appending PATH to resourcePath
2025-03-19T18:39:11.931288Z DEBUG dsc_lib::discovery::command_discovery: 154: Using Resource Path: "C:\\Program Files\\PowerShell\\7;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Users\\Desired Mage\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Desired Mage\\AppData\\Local\\Microsoft\\WinGet\\Packages\\Microsoft.DSC_Microsoft.Winget.Source_8wekyb3d8bbwe;C:\\Users\\Desired Mage\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Program Files\\WindowsApps\\Microsoft.DesiredStateConfiguration-Preview_3.0.12.0_x64__8wekyb3d8bbwe"
2025-03-19T18:39:12.346213Z DEBUG dsc_lib::discovery::command_discovery: 241: Found 7 matching non-adapter-based resources
2025-03-19T18:39:12.347609Z DEBUG dsc_lib::discovery::command_discovery: 257: Using regex ^Microsoft\.Windows/WindowsPowerShell$ as filter for adapter name
2025-03-19T18:39:12.350723Z DEBUG dsc_lib::discovery::command_discovery: 265: Using regex ^.*?$ as filter for resource name
2025-03-19T18:39:12.351847Z  INFO dsc_lib::discovery::command_discovery: 289: Enumerating resources for adapter 'Microsoft.Windows/WindowsPowerShell'
2025-03-19T18:39:12.353158Z DEBUG dsc_lib::dscresources::command_resource: 663: Invoking command 'powershell' with args Some(["-NoLogo", "-NonInteractive", "-NoProfile", "-Command", "./psDscAdapter/powershell.resource.ps1 List"])
2025-03-19T18:39:13.318082Z DEBUG dsc_lib::dscresources::command_resource: 624: Process 'powershell' id 6520 exited with code 1
2025-03-19T18:39:13.319220Z  WARN dsc_lib::discovery::command_discovery: 314: Command: Resource 'powershell' [Exit code 1] manifest description: Error
2025-03-19T18:39:13.320763Z DEBUG dsc_lib::discovery::command_discovery: 661: Read 0 items into lookup table from "C:\\Users\\Desired Mage\\AppData\\Local\\dsc\\AdaptedResourcesLookupTable.json"

Error details

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

3.0.0-preview.12

Visuals

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions