DSC icon indicating copy to clipboard operation
DSC copied to clipboard

PowerShell DSC resource is not registered as a WMI DSC resource

Open m-mrks opened this issue 9 months ago • 5 comments

Prerequisites

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

Summary

Hi all,

My apologies for raising an issue on this, I couldn't find any usefull guidance on an empty getting started page, so I have to trial-and-error.

Goal is to migrate from PSDSC to DSC3.

As a first test, I want to set a different timezone, and that fails using DSC 3.0.0 with PowerShell 7.5 on Windows Server 2022 using ComputerManagementDsc 10.0.0.

Message in the trace reads:

PowerShell DSC resource DSC_TimeZone from module <ComputerManagementDsc,10.0.0> does not exist at the PowerShell module path nor is it registered as a WMI DSC resource

As far as I know the ComputerManagementDsc resource uses CIM instead of WMI.

I'm puzzled; how to set the timezone using DSC3?

Steps to reproduce

The test_timezone.json file:

{
  "IsSingleInstance": "Yes",
  "TimeZone": "W. Europe Standard Time"
}

And the resource:

PS C:\> dsc resource list --adapter Microsoft.Windows/WindowsPowerShell ComputerManagementDsc/TimeZone

Type                            Kind      Version  Capabilities  RequireAdapter                       Description
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ComputerManagementDsc/TimeZone  Resource  10.0.0   gs--t---      Microsoft.Windows/WindowsPowerShell  DSC resources for configuration of a Windows computer. These DSC resources allow you to perform computer management tasks, such as renaming the computer, joining a domain and …

Expected behavior

A working test for

`dsc resource test --resource ComputerManagementDsc/TimeZone --file C:\Users\Administrator\Desktop\test_timezone.json`

Actual behavior

PS C:\> dsc --trace-level info resource test --resource ComputerManagementDsc/TimeZone --file C:\Users\Administrator\Desktop\test_timezone.json
←[2m2025-03-14T15:53:52.039086Z←[0m ←[32m INFO←[0m Trace-level is Info
←[2m2025-03-14T15:53:52.039873Z←[0m ←[32m INFO←[0m Discovering resources using filter: *
2025-03-14T15:53:52.127497Z  INFO Enumerating resources for adapter 'Microsoft.Windows/WindowsPowerShell'
2025-03-14T15:53:55.425702Z  INFO Resource 'PackageManagement/PackageManagement' has invalid version: unexpected character '.' after patch version number
2025-03-14T15:53:55.427167Z  INFO Resource 'PackageManagement/PackageManagementSource' has invalid version: unexpected character '.' after patch version number
2025-03-14T15:53:55.430684Z  INFO Invoking validate on 'Microsoft.Windows/WindowsPowerShell' using 'powershell'
2025-03-14T15:53:55.695553Z  INFO Invoking test on 'Microsoft.Windows/WindowsPowerShell' using '{executable}'
2025-03-14T15:53:57.197276Z ERROR Command: Resource 'powershell' [exit code 1] manifest description: Error

Error details

PS C:\> dsc --trace-level info resource test --resource ComputerManagementDsc/TimeZone --file C:\Users\Administrator\Desktop\test_timezone.json

←[2m2025-03-14T15:53:52.039086Z←[0m ←[32m INFO←[0m Trace-level is Info
←[2m2025-03-14T15:53:52.039873Z←[0m ←[32m INFO←[0m Discovering resources using filter: *
2025-03-14T15:53:52.127497Z  INFO Enumerating resources for adapter 'Microsoft.Windows/WindowsPowerShell'
2025-03-14T15:53:55.425702Z  INFO Resource 'PackageManagement/PackageManagement' has invalid version: unexpected character '.' after patch version number
2025-03-14T15:53:55.427167Z  INFO Resource 'PackageManagement/PackageManagementSource' has invalid version: unexpected character '.' after patch version number
2025-03-14T15:53:55.430684Z  INFO Invoking validate on 'Microsoft.Windows/WindowsPowerShell' using 'powershell'
2025-03-14T15:53:55.695553Z  INFO Invoking test on 'Microsoft.Windows/WindowsPowerShell' using '{executable}'
2025-03-14T15:53:57.197276Z ERROR Command: Resource 'powershell' [exit code 1] manifest description: Error
PS C:\> dsc --trace-level trace resource test --resource ComputerManagementDsc/TimeZone --file C:\Users\Administrator\Desktop\test_timezone.json
←[2m2025-03-14T15:54:20.785479Z←[0m ←[32m INFO←[0m ←[2mdsc::util←[0m←[2m:←[0m ←[2m417:←[0m Trace-level is Trace
←[2m2025-03-14T15:54:20.786292Z←[0m ←[34mDEBUG←[0m ←[2mdsc←[0m←[2m:←[0m ←[2m42:←[0m Running DSC version: 3.0.0
←[2m2025-03-14T15:54:20.786854Z←[0m ←[34mDEBUG←[0m ←[2mdsc_lib::discovery::command_discovery←[0m←[2m:←[0m ←[2m381:←[0m Searching for resources: ["ComputerManagementDsc/TimeZone"]
←[2m2025-03-14T15:54:20.787684Z←[0m ←[32m INFO←[0m ←[2mdsc_lib::discovery::command_discovery←[0m←[2m:←[0m ←[2m173:←[0m Discovering resources using filter: *
←[2m2025-03-14T15:54:20.788278Z←[0m ←[34mDEBUG←[0m ←[2mdsc_lib::discovery::command_discovery←[0m←[2m:←[0m ←[2m176:←[0m Using regex ^.*?$ as filter for adapter name
2025-03-14T15:54:20.791163Z DEBUG dsc_lib::util: 90: Found setting 'resourcePath' in C:\Windows\dsc3\dsc_default.settings.json
2025-03-14T15:54:20.792861Z DEBUG dsc_lib::util: 100: Found setting 'resourcePath' in C:\Windows\dsc3\dsc.settings.json
2025-03-14T15:54:20.793643Z DEBUG dsc_lib::util: 114: Setting 'resourcePath' not found in C:\ProgramData\dsc\dsc.settings.json
2025-03-14T15:54:20.795595Z DEBUG dsc_lib::discovery::command_discovery: 122: Appending PATH to resourcePath
2025-03-14T15:54:20.796272Z TRACE dsc_lib::discovery::command_discovery: 125: 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\AzureConnectedMachineAgent\;C:\Program Files\PowerShell\7\;C:\Program Files\Microsoft VS Code\bin;C:\Windows\dsc3;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;
2025-03-14T15:54:20.797148Z TRACE dsc_lib::discovery::command_discovery: 144: Exe home is already in path: C:\Windows\dsc3
2025-03-14T15:54:20.797882Z DEBUG dsc_lib::discovery::command_discovery: 157: 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:\Program Files\AzureConnectedMachineAgent\;C:\Program Files\Microsoft VS Code\bin;C:\Windows\dsc3;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;
2025-03-14T15:54:20.884054Z TRACE dsc_lib::discovery::command_discovery: 208: Found resource manifest: C:\Windows\dsc3\assertion.dsc.resource.json
2025-03-14T15:54:20.885729Z TRACE dsc_lib::discovery::command_discovery: 229: Resource 'Microsoft.DSC/Assertion' found
2025-03-14T15:54:20.886483Z TRACE dsc_lib::discovery::command_discovery: 208: Found resource manifest: C:\Windows\dsc3\echo.dsc.resource.json
2025-03-14T15:54:20.887221Z TRACE dsc_lib::discovery::command_discovery: 229: Resource 'Microsoft.DSC.Debug/Echo' found
2025-03-14T15:54:20.888054Z TRACE dsc_lib::discovery::command_discovery: 208: Found resource manifest: C:\Windows\dsc3\group.dsc.resource.json
2025-03-14T15:54:20.888807Z TRACE dsc_lib::discovery::command_discovery: 229: Resource 'Microsoft.DSC/Group' found
2025-03-14T15:54:20.889446Z TRACE dsc_lib::discovery::command_discovery: 208: Found resource manifest: C:\Windows\dsc3\include.dsc.resource.json
2025-03-14T15:54:20.890213Z TRACE dsc_lib::discovery::command_discovery: 229: Resource 'Microsoft.DSC/Include' found
2025-03-14T15:54:20.890872Z TRACE dsc_lib::discovery::command_discovery: 208: Found resource manifest: C:\Windows\dsc3\osinfo.dsc.resource.json
2025-03-14T15:54:20.891670Z TRACE dsc_lib::discovery::command_discovery: 229: Resource 'Microsoft/OSInfo' found
2025-03-14T15:54:20.892337Z TRACE dsc_lib::discovery::command_discovery: 208: Found resource manifest: C:\Windows\dsc3\powershell.dsc.resource.json
2025-03-14T15:54:20.893087Z TRACE dsc_lib::discovery::command_discovery: 226: Resource adapter 'Microsoft.DSC/PowerShell' found
2025-03-14T15:54:20.894675Z TRACE dsc_lib::discovery::command_discovery: 208: Found resource manifest: C:\Windows\dsc3\reboot_pending.dsc.resource.json
2025-03-14T15:54:20.895698Z TRACE dsc_lib::discovery::command_discovery: 229: Resource 'Microsoft.Windows/RebootPending' found
2025-03-14T15:54:20.896455Z TRACE dsc_lib::discovery::command_discovery: 208: Found resource manifest: C:\Windows\dsc3\registry.dsc.resource.json
2025-03-14T15:54:20.897218Z TRACE dsc_lib::discovery::command_discovery: 229: Resource 'Microsoft.Windows/Registry' found
2025-03-14T15:54:20.898094Z TRACE dsc_lib::discovery::command_discovery: 208: Found resource manifest: C:\Windows\dsc3\RunCommandOnSet.dsc.resource.json
2025-03-14T15:54:20.898903Z TRACE dsc_lib::discovery::command_discovery: 229: Resource 'Microsoft.DSC.Transitional/RunCommandOnSet' found
2025-03-14T15:54:20.899574Z TRACE dsc_lib::discovery::command_discovery: 208: Found resource manifest: C:\Windows\dsc3\windowspowershell.dsc.resource.json
2025-03-14T15:54:20.900304Z TRACE dsc_lib::discovery::command_discovery: 226: Resource adapter 'Microsoft.Windows/WindowsPowerShell' found
2025-03-14T15:54:20.900990Z TRACE dsc_lib::discovery::command_discovery: 208: Found resource manifest: C:\Windows\dsc3\wmi.dsc.resource.json
2025-03-14T15:54:20.907290Z TRACE dsc_lib::discovery::command_discovery: 226: Resource adapter 'Microsoft.Windows/WMI' found
2025-03-14T15:54:20.910193Z DEBUG dsc_lib::discovery::command_discovery: 241: Found 8 matching non-adapter-based resources
2025-03-14T15:54:20.911696Z DEBUG dsc_lib::discovery::command_discovery: 409: Found 0 matching non-adapter-based resources
2025-03-14T15:54:20.913060Z DEBUG dsc_lib::discovery::command_discovery: 656: Read 1336 items into lookup table from "C:\\Users\\Administrator\\AppData\\Local\\dsc\\AdaptedResourcesLookupTable.json"
2025-03-14T15:54:20.913854Z DEBUG dsc_lib::discovery::command_discovery: 586: Lookup table found resource 'computermanagementdsc/timezone' in adapter 'Microsoft.Windows/WindowsPowerShell'
2025-03-14T15:54:20.914676Z DEBUG dsc_lib::discovery::command_discovery: 257: Using regex ^Microsoft\.Windows/WindowsPowerShell$ as filter for adapter name
2025-03-14T15:54:20.915583Z DEBUG dsc_lib::discovery::command_discovery: 265: Using regex ^.*?$ as filter for resource name
2025-03-14T15:54:20.917307Z  INFO dsc_lib::discovery::command_discovery: 287: Enumerating resources for adapter 'Microsoft.Windows/WindowsPowerShell'
2025-03-14T15:54:20.923590Z DEBUG dsc_lib::dscresources::command_resource: 672: Invoking command 'powershell' with args Some(["-NoLogo", "-NonInteractive", "-NoProfile", "-Command", "./psDscAdapter/powershell.resource.ps1 List"])
2025-03-14T15:54:21.167759Z TRACE dsc_lib::dscresources::command_resource: 870: PID 4856: {"debug":"PSVersion=5.1.20348.2849"}
2025-03-14T15:54:21.168880Z TRACE dsc_lib::dscresources::command_resource: 870: PID 4856: {"debug":"PSPath=C:\\Windows\\System32\\WindowsPowerShell\\v1.0"}
2025-03-14T15:54:21.170168Z TRACE dsc_lib::dscresources::command_resource: 870: PID 4856: {"debug":"PSModulePath=C:\\Users\\Administrator\\Documents\\PowerShell\\Modules;C:\\Program Files\\PowerShell\\Modules;c:\\program files\\powershell\\7\\Modules;C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules"}
2025-03-14T15:54:21.173782Z TRACE dsc_lib::dscresources::command_resource: 870: PID 4856: {"debug":"jsonInput=@{}"}
2025-03-14T15:54:21.437506Z DEBUG dsc_lib::dscresources::command_resource: 865: PID 4856: Reading from Get-DscResource cache file C:\Users\Administrator\AppData\Local\dsc\WindowsPSAdapterCache.json
2025-03-14T15:54:21.515900Z DEBUG dsc_lib::dscresources::command_resource: 865: PID 4856: Checking cache for stale entries
2025-03-14T15:54:21.821385Z DEBUG dsc_lib::dscresources::command_resource: 865: PID 4856: Checking cache for stale PSModulePath
2025-03-14T15:54:21.864679Z DEBUG dsc_lib::dscresources::command_resource: 865: PID 4856: PSModulePath diff ''
2025-03-14T15:54:24.318294Z DEBUG dsc_lib::dscresources::command_resource: 633: Process 'powershell' id 4856 exited with code 0
2025-03-14T15:54:24.321536Z  INFO dsc_lib::discovery::command_discovery: 474: Resource 'PackageManagement/PackageManagement' has invalid version: unexpected character '.' after patch version number
2025-03-14T15:54:24.322556Z  INFO dsc_lib::discovery::command_discovery: 474: Resource 'PackageManagement/PackageManagementSource' has invalid version: unexpected character '.' after patch version number
2025-03-14T15:54:24.324066Z DEBUG dsc_lib::discovery::command_discovery: 342: Adapter 'Microsoft.Windows/WindowsPowerShell' listed 112 resources
2025-03-14T15:54:24.327078Z DEBUG dsc_lib::discovery::command_discovery: 656: Read 1336 items into lookup table from "C:\\Users\\Administrator\\AppData\\Local\\dsc\\AdaptedResourcesLookupTable.json"
2025-03-14T15:54:24.328063Z TRACE dsc::util: 454: Input: None, File: Some("C:\\Users\\Administrator\\Desktop\\test_timezone.json")
2025-03-14T15:54:24.331918Z DEBUG dsc::util: 465: Reading input from file C:\Users\Administrator\Desktop\test_timezone.json
2025-03-14T15:54:24.332862Z DEBUG dsc::resource_command: 165: ComputerManagementDsc/TimeZone implemented as Custom("0")
2025-03-14T15:54:24.333571Z DEBUG dsc_lib::dscresources::dscresource: 225: Invoking test for 'Microsoft.Windows/WindowsPowerShell'
2025-03-14T15:54:24.334193Z DEBUG dsc_lib::dscresources::command_resource: 252: Invoking test for 'Microsoft.Windows/WindowsPowerShell'
2025-03-14T15:54:24.334842Z DEBUG dsc_lib::dscresources::command_resource: 738: Verify JSON for 'Microsoft.Windows/WindowsPowerShell'
2025-03-14T15:54:24.335431Z TRACE dsc_lib::dscresources::command_resource: 742: Validating against JSON: {"IsSingleInstance":"Yes","TimeZone":"W. Europe Standard Time","adapted_dsc_type":"ComputerManagementDsc/TimeZone"}
2025-03-14T15:54:24.336028Z TRACE dsc_lib::dscresources::command_resource: 405: Invoking validate on 'Microsoft.Windows/WindowsPowerShell' using '{"IsSingleInstance":"Yes","TimeZone":"W. Europe Standard Time","adapted_dsc_type":"ComputerManagementDsc/TimeZone"}'
2025-03-14T15:54:24.336612Z DEBUG dsc_lib::dscresources::command_resource: 725: No input kind specified
2025-03-14T15:54:24.337182Z  INFO dsc_lib::dscresources::command_resource: 414: Invoking validate on 'Microsoft.Windows/WindowsPowerShell' using 'powershell'
2025-03-14T15:54:24.337760Z DEBUG dsc_lib::dscresources::command_resource: 672: Invoking command 'powershell' with args Some(["-NoLogo", "-NonInteractive", "-NoProfile", "-Command", "$Input | ./psDscAdapter/powershell.resource.ps1 Validate"])
2025-03-14T15:54:24.575088Z TRACE dsc_lib::dscresources::command_resource: 870: PID 1744: {"debug":"PSVersion=5.1.20348.2849"}
2025-03-14T15:54:24.576239Z TRACE dsc_lib::dscresources::command_resource: 870: PID 1744: {"debug":"PSPath=C:\\Windows\\System32\\WindowsPowerShell\\v1.0"}
2025-03-14T15:54:24.576984Z TRACE dsc_lib::dscresources::command_resource: 870: PID 1744: {"debug":"PSModulePath=C:\\Users\\Administrator\\Documents\\PowerShell\\Modules;C:\\Program Files\\PowerShell\\Modules;c:\\program files\\powershell\\7\\Modules;C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules"}
2025-03-14T15:54:24.607793Z DEBUG dsc_lib::dscresources::command_resource: 633: Process 'powershell' id 1744 exited with code 0
2025-03-14T15:54:24.609154Z DEBUG dsc_lib::dscresources::command_resource: 721: Parsing input as stdin
2025-03-14T15:54:24.612329Z  INFO dsc_lib::dscresources::command_resource: 263: Invoking test on 'Microsoft.Windows/WindowsPowerShell' using '{executable}'
2025-03-14T15:54:24.613031Z DEBUG dsc_lib::dscresources::command_resource: 672: Invoking command 'powershell' with args Some(["-NoLogo", "-NonInteractive", "-NoProfile", "-Command", "$Input | ./psDscAdapter/powershell.resource.ps1 Test"])
2025-03-14T15:54:24.621138Z TRACE dsc_lib::dscresources::command_resource: 589: Writing to command STDIN: {"IsSingleInstance":"Yes","TimeZone":"W. Europe Standard Time","adapted_dsc_type":"ComputerManagementDsc/TimeZone"}
2025-03-14T15:54:24.851519Z TRACE dsc_lib::dscresources::command_resource: 870: PID 7348: {"debug":"PSVersion=5.1.20348.2849"}
2025-03-14T15:54:24.852740Z TRACE dsc_lib::dscresources::command_resource: 870: PID 7348: {"debug":"PSPath=C:\\Windows\\System32\\WindowsPowerShell\\v1.0"}
2025-03-14T15:54:24.853502Z TRACE dsc_lib::dscresources::command_resource: 870: PID 7348: {"debug":"PSModulePath=C:\\Users\\Administrator\\Documents\\PowerShell\\Modules;C:\\Program Files\\PowerShell\\Modules;c:\\program files\\powershell\\7\\Modules;C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules"}
2025-03-14T15:54:24.855685Z TRACE dsc_lib::dscresources::command_resource: 870: PID 7348: {"debug":"jsonInput={\"IsSingleInstance\":\"Yes\",\"TimeZone\":\"W. Europe Standard Time\",\"adapted_dsc_type\":\"ComputerManagementDsc/TimeZone\"}"}
2025-03-14T15:54:25.143667Z DEBUG dsc_lib::dscresources::command_resource: 865: PID 7348: Reading from Get-DscResource cache file C:\Users\Administrator\AppData\Local\dsc\WindowsPSAdapterCache.json
2025-03-14T15:54:25.219593Z DEBUG dsc_lib::dscresources::command_resource: 865: PID 7348: Checking cache for stale entries
2025-03-14T15:54:25.519230Z DEBUG dsc_lib::dscresources::command_resource: 865: PID 7348: Checking cache for stale PSModulePath
2025-03-14T15:54:25.565726Z DEBUG dsc_lib::dscresources::command_resource: 865: PID 7348: PSModulePath diff ''
2025-03-14T15:54:25.587429Z DEBUG dsc_lib::dscresources::command_resource: 865: PID 7348: OS version: Microsoft Windows NT 10.0.20348.0
2025-03-14T15:54:25.588960Z DEBUG dsc_lib::dscresources::command_resource: 865: PID 7348: PowerShell version: 5.1.20348.2849
2025-03-14T15:54:25.592980Z DEBUG dsc_lib::dscresources::command_resource: 865: PID 7348: PSDesiredStateConfiguration module version: 1.1
2025-03-14T15:54:25.622276Z DEBUG dsc_lib::dscresources::command_resource: 865: PID 7348: DSC resource implementation: ScriptBased
2025-03-14T15:54:25.942694Z TRACE dsc_lib::dscresources::command_resource: 875: PID 7348: The PowerShell DSC resource DSC_TimeZone from module <ComputerManagementDsc,10.0.0> does not exist at the PowerShell module path nor is it registered as a WMI DSC resource.{"Error":"Exception: You cannot call a method on a null-valued expression."}
2025-03-14T15:54:25.967040Z DEBUG dsc_lib::dscresources::command_resource: 633: Process 'powershell' id 7348 exited with code 1
2025-03-14T15:54:25.968795Z ERROR dsc::resource_command: 194: Command: Resource 'powershell' [exit code 1] manifest description: Error

Environment data

PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Microsoft Windows 10.0.20348
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

Visuals

No response

m-mrks avatar Mar 14 '25 16:03 m-mrks

Hi @m-mrks, what is the module's installed location? If it is in your user profile, can you move the module to: C:\Program Files\WindowsPowerShell\Modules? I think this is a known limitation.

Gijsreyn avatar Mar 16 '25 04:03 Gijsreyn

Thanks, that worked.

However, the original location was not in a user profile, but in C:\Program Files\PowerShell\Modules:

PS C:\> Get-Module -Name 'ComputerManagementDsc' -ListAvailable

    Directory: C:\Program Files\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     10.0.0                ComputerManagementDsc               Desk

PS C:\> $env:PSModulePath -split ';'
C:\Users\Administrator\Documents\PowerShell\Modules
C:\Program Files\PowerShell\Modules
c:\program files\powershell\7\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\Windows\system32\WindowsPowerShell\v1.0\Modules

After moving the module to C:\Program Files\WindowsPowerShell\Modules this test succeeded:

PS C:\> Get-Module -Name 'ComputerManagementDsc' -ListAvailable

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     10.0.0                ComputerManagementDsc               Desk

PS C:\> dsc resource test --resource ComputerManagementDsc/TimeZone --file C:\Users\Administrator\Desktop\test_timezone.json
desiredState:
  IsSingleInstance: Yes
  TimeZone: W. Europe Standard Time
  adapted_dsc_type: ComputerManagementDsc/TimeZone
actualState:
  result:
  - name: Microsoft.Windows/WindowsPowerShell
    type: ComputerManagementDsc/TimeZone
    properties:
      InDesiredState: false
inDesiredState: false
differingProperties:
- IsSingleInstance
- TimeZone
- adapted_dsc_type

m-mrks avatar Mar 17 '25 08:03 m-mrks

Yes correct, that's the PowerShell 7 folder. As you're using the WindowsPowerShell adapter, it should be in that folder you've mentioned :).

I don't think this is a limitation of dsc.exe, rather PSDSC, which is dsc v3 prior versions (e.g. 1.1/2.0).

Gijsreyn avatar Mar 17 '25 10:03 Gijsreyn

Thanks again for the additional clarification.

Somewhat unrelated, but are there any recommendations on deploying DSC modules?

Until now we've used Install-Module for PSDSC, but if I understand you correctly, we need the Windows PowerShell module path instead:

called from cmdlet package manager module path
pwsh 7.5.0 Install-Module -Name 'ComputerManagementDsc' -Scope 'AllUsers' PowerShellGet 2.2.5 C:\Program Files\PowerShell\Modules\
pwsh 7.5.0 Install-PSResource -Name 'ComputerManagementDsc' -Scope 'AllUsers' Microsoft.PowerShell.PSResourceGet 1.1.0 C:\Program Files\PowerShell\Modules\
powershell 5.1 Install-Module -Name 'ComputerManagementDsc' -Scope 'AllUsers' PowerShellGet 1.0.0.1 C:\Program Files\WindowsPowerShell\Modules\

So, is a Save-Module -Path 'C:\Program Files\WindowsPowerShell\Modules\' good practice instead of a Install-Module or Install-PSResource call? Or do I miss something then?

m-mrks avatar Mar 17 '25 16:03 m-mrks

More of a personal opinion, I would move away from using Install-Module on PowerShell 7+. The Microsoft.PowerShell.PSResourceGet is shipped with it. You don't have to rely on the PowerShellGet anymore. Regardless, for PowerShell 5.1 and lower, Install-Module should just work fine. I can't say something currently on Save-Module, as the adapter mostly leverages both Get-DscResource and Get-Module for discovering resources.

Gijsreyn avatar Mar 17 '25 16:03 Gijsreyn