PowerShell / PowerShell/DSC

Failed to serialize properties into CimInstance

Open
#1,001 10 comments 0 reactions 1 assignee View on GitHub

@michaeltlombardi is already working on this.

Since Aug 4, 2025.

Issue-Bug
Dominant language
Rust
Stars
523
Forks
75
Avg merge
3d 16h
Merged PRs (30d)
24

Description

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

If a DSC resource uses custom CIM types in this case for AccessControlDsc/NTFSAccessEntry serialization will fail. This resource utilizes two nested custom types NTFSAccessControlEntry and NTFSAccessControlList.

https://github.com/mcollera/AccessControlDsc/blob/Dev/DscResources/NTFSAccessEntry/NTFSAccessEntry.schema.mof

Steps to reproduce

Took this example and turned it into dsc v3 notation: https://github.com/mcollera/AccessControlDsc/blob/Dev/Examples/NtfsAccessEntry_example.ps1

$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: test
  type: AccessControlDSC/NTFSAccessEntry
  properties:
    Path: c:\temp\test
    AccessControlList:
      - Principal: Everyone
        AccessControlEntry:
          - AccessControlType: Allow
            FileSystemRights: FullControl
            Inheritance: This folder and files
            Ensure: Present
Expected behavior
Works
Actual behavior
2025-07-24T04:31:29.303209Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496:

Message        : Failed to serialize properties into CimInstance.
Data           : {}
InnerException :
TargetSite     : Microsoft.Management.Infrastructure.CimInstance SerializeIntoCimInstance(System.Management.Automation.Language.DynamicKeyword, Microsoft.PowerShell.Commands.ModuleSpecification, System.Collections.Hashtable)
StackTrace     :    at Microsoft.PowerShell.DesiredStateConfiguration.Commands.InvokeDscResourceMethodCommand.SerializeIntoCimInstance(DynamicKeyword resourceInfo, ModuleSpecification moduleSpecification, Hashtable property)
                    at Microsoft.PowerShell.DesiredStateConfiguration.Commands.InvokeDscResourceMethodCommand.CreateParametersCollection()
                    at Microsoft.PowerShell.DesiredStateConfiguration.Commands.InvokeDscResourceMethodCommand.ProcessRecord()
                    at System.Management.Automation.CommandProcessor.ProcessRecord()
HelpLink       :
Source         : Microsoft.Windows.DSC.CoreConfProviders
HResult        : -2146233076




2025-07-24T04:31:29.304567Z ERROR dsc_lib::dscresources::command_resource: 896: PID 27496: Exception: Failed to serialize properties into CimInstance.
2025-07-24T04:31:29.322548Z DEBUG dsc_lib::dscresources::command_resource: 660: Process 'powershell' id 27496 exited with code 1
2025-07-24T04:31:29.323978Z ERROR dsc::subcommand: 75: Command: Resource 'powershell' [exit code 1] manifest description: Error
Error details
2025-07-24T04:31:28.204698Z DEBUG dsc_lib::configure::depends_on: 90: Resource invocation order: [Resource { resource_type: "Microsoft.Windows/WindowsPowerShell", name: "AccessControlDSC/NTFSAccessEntry", depends_on: None, kind: None, properties: Some({"resources": Array [Object {"name": String("AccessControlDSC/NTFSAccessEntry"), "type": String("AccessControlDSC/NTFSAccessEntry"), "properties": Object {"Path": String("c:\\temp\\test"), "AccessControlList": Array [Object {"Principal": String("Everyone"), "AccessControlEntry": Array [Object {"AccessControlType": String("Allow"), "FileSystemRights": String("FullControl"), "Inheritance": String("This folder and files"), "Ensure": String("Present")}]}]}}]}), metadata: None, condition: None }]
2025-07-24T04:31:28.205089Z DEBUG dsc_lib::configure: 860: Invoke property expressions
2025-07-24T04:31:28.205443Z TRACE dsc_lib::configure: 868: Invoke property expression for resources: [{"name":"AccessControlDSC/NTFSAccessEntry","type":"AccessControlDSC/NTFSAccessEntry","properties":{"Path":"c:\\temp\\test","AccessControlList":[{"Principal":"Everyone","AccessControlEntry":[{"AccessControlType":"Allow","FileSystemRights":"FullControl","Inheritance":"This folder and files","Ensure":"Present"}]}]}}]
2025-07-24T04:31:28.205767Z DEBUG dsc_lib::configure: 860: Invoke property expressions
2025-07-24T04:31:28.206177Z TRACE dsc_lib::configure: 868: Invoke property expression for name: "AccessControlDSC/NTFSAccessEntry"
2025-07-24T04:31:28.206498Z DEBUG dsc_lib::parser: 48: Parsing statement: AccessControlDSC/NTFSAccessEntry
2025-07-24T04:31:28.206826Z DEBUG dsc_lib::parser: 72: Parsing string literal: AccessControlDSC/NTFSAccessEntry
2025-07-24T04:31:28.207156Z TRACE dsc_lib::configure: 868: Invoke property expression for type: "AccessControlDSC/NTFSAccessEntry"
2025-07-24T04:31:28.207498Z DEBUG dsc_lib::parser: 48: Parsing statement: AccessControlDSC/NTFSAccessEntry
2025-07-24T04:31:28.207817Z DEBUG dsc_lib::parser: 72: Parsing string literal: AccessControlDSC/NTFSAccessEntry
2025-07-24T04:31:28.208135Z TRACE dsc_lib::configure: 868: Invoke property expression for properties: {"Path":"c:\\temp\\test","AccessControlList":[{"Principal":"Everyone","AccessControlEntry":[{"AccessControlType":"Allow","FileSystemRights":"FullControl","Inheritance":"This folder and files","Ensure":"Present"}]}]}
2025-07-24T04:31:28.208433Z DEBUG dsc_lib::configure: 860: Invoke property expressions
2025-07-24T04:31:28.208769Z TRACE dsc_lib::configure: 868: Invoke property expression for Path: "c:\\temp\\test"
2025-07-24T04:31:28.209084Z DEBUG dsc_lib::parser: 48: Parsing statement: c:\temp\test
2025-07-24T04:31:28.209407Z DEBUG dsc_lib::parser: 72: Parsing string literal: c:\temp\test
2025-07-24T04:31:28.209775Z TRACE dsc_lib::configure: 868: Invoke property expression for AccessControlList: [{"Principal":"Everyone","AccessControlEntry":[{"AccessControlType":"Allow","FileSystemRights":"FullControl","Inheritance":"This folder and files","Ensure":"Present"}]}]
2025-07-24T04:31:28.210094Z DEBUG dsc_lib::configure: 860: Invoke property expressions
2025-07-24T04:31:28.210305Z TRACE dsc_lib::configure: 868: Invoke property expression for Principal: "Everyone"
2025-07-24T04:31:28.210546Z DEBUG dsc_lib::parser: 48: Parsing statement: Everyone
2025-07-24T04:31:28.210846Z DEBUG dsc_lib::parser: 72: Parsing string literal: Everyone
2025-07-24T04:31:28.211208Z TRACE dsc_lib::configure: 868: Invoke property expression for AccessControlEntry: [{"AccessControlType":"Allow","FileSystemRights":"FullControl","Inheritance":"This folder and files","Ensure":"Present"}]
2025-07-24T04:31:28.211482Z DEBUG dsc_lib::configure: 860: Invoke property expressions
2025-07-24T04:31:28.211768Z TRACE dsc_lib::configure: 868: Invoke property expression for AccessControlType: "Allow"
2025-07-24T04:31:28.212089Z DEBUG dsc_lib::parser: 48: Parsing statement: Allow
2025-07-24T04:31:28.212454Z DEBUG dsc_lib::parser: 72: Parsing string literal: Allow
2025-07-24T04:31:28.212772Z TRACE dsc_lib::configure: 868: Invoke property expression for FileSystemRights: "FullControl"
2025-07-24T04:31:28.213112Z DEBUG dsc_lib::parser: 48: Parsing statement: FullControl
2025-07-24T04:31:28.213452Z DEBUG dsc_lib::parser: 72: Parsing string literal: FullControl
2025-07-24T04:31:28.213745Z TRACE dsc_lib::configure: 868: Invoke property expression for Inheritance: "This folder and files"
2025-07-24T04:31:28.214070Z DEBUG dsc_lib::parser: 48: Parsing statement: This folder and files
2025-07-24T04:31:28.214426Z DEBUG dsc_lib::parser: 72: Parsing string literal: This folder and files
2025-07-24T04:31:28.214746Z TRACE dsc_lib::configure: 868: Invoke property expression for Ensure: "Present"
2025-07-24T04:31:28.215072Z DEBUG dsc_lib::parser: 48: Parsing statement: Present
2025-07-24T04:31:28.215429Z DEBUG dsc_lib::parser: 72: Parsing string literal: Present
2025-07-24T04:31:28.215771Z DEBUG dsc_lib::configure: 332: resource_type Microsoft.Windows/WindowsPowerShell
2025-07-24T04:31:28.216065Z TRACE dsc_lib::configure: 334: filter: {"resources":[{"name":"AccessControlDSC/NTFSAccessEntry","type":"AccessControlDSC/NTFSAccessEntry","properties":{"Path":"c:\\temp\\test","AccessControlList":[{"Principal":"Everyone","AccessControlEntry":[{"AccessControlType":"Allow","FileSystemRights":"FullControl","Inheritance":"This folder and files","Ensure":"Present"}]}]}}],"metadata":{"Microsoft.DSC":{"context":"configuration"}}}
2025-07-24T04:31:28.216450Z DEBUG dsc_lib::dscresources::dscresource: 218: Invoking get for 'Microsoft.Windows/WindowsPowerShell'
2025-07-24T04:31:28.216850Z DEBUG dsc_lib::dscresources::command_resource: 29: Invoking get for 'Microsoft.Windows/WindowsPowerShell'
2025-07-24T04:31:28.217189Z DEBUG dsc_lib::dscresources::command_resource: 775: Verify JSON for 'Microsoft.Windows/WindowsPowerShell'
2025-07-24T04:31:28.217553Z TRACE dsc_lib::dscresources::command_resource: 779: Validating against JSON: {"resources":[{"name":"AccessControlDSC/NTFSAccessEntry","type":"AccessControlDSC/NTFSAccessEntry","properties":{"Path":"c:\\temp\\test","AccessControlList":[{"Principal":"Everyone","AccessControlEntry":[{"AccessControlType":"Allow","FileSystemRights":"FullControl","Inheritance":"This folder and files","Ensure":"Present"}]}]}}],"metadata":{"Microsoft.DSC":{"context":"configuration"}}}
2025-07-24T04:31:28.217930Z TRACE dsc_lib::dscresources::command_resource: 432: Invoking validate on 'Microsoft.Windows/WindowsPowerShell' using '{"resources":[{"name":"AccessControlDSC/NTFSAccessEntry","type":"AccessControlDSC/NTFSAccessEntry","properties":{"Path":"c:\\temp\\test","AccessControlList":[{"Principal":"Everyone","AccessControlEntry":[{"AccessControlType":"Allow","FileSystemRights":"FullControl","Inheritance":"This folder and files","Ensure":"Present"}]}]}}],"metadata":{"Microsoft.DSC":{"context":"configuration"}}}'
2025-07-24T04:31:28.218303Z DEBUG dsc_lib::dscresources::command_resource: 762: No input kind specified
2025-07-24T04:31:28.218758Z  INFO dsc_lib::dscresources::command_resource: 441: Invoking validate on 'Microsoft.Windows/WindowsPowerShell' using 'powershell'
2025-07-24T04:31:28.219087Z DEBUG dsc_lib::dscresources::command_resource: 699: Invoking command 'powershell' with args Some(["-NoLogo", "-NonInteractive", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", "$Input | ./psDscAdapter/powershell.resource.ps1 Validate"])
2025-07-24T04:31:28.493965Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 24376: PSVersion=5.1.26100.4652
2025-07-24T04:31:28.494651Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 24376: PSPath=C:\Windows\System32\WindowsPowerShell\v1.0
2025-07-24T04:31:28.494853Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 24376: PSModulePath=C:\Users\Thomas\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7-preview\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
2025-07-24T04:31:28.519407Z DEBUG dsc_lib::dscresources::command_resource: 660: Process 'powershell' id 24376 exited with code 0
2025-07-24T04:31:28.520238Z DEBUG dsc_lib::dscresources::command_resource: 758: Parsing input as stdin
2025-07-24T04:31:28.520459Z  INFO dsc_lib::dscresources::command_resource: 40: Invoking get 'Microsoft.Windows/WindowsPowerShell' using 'powershell'
2025-07-24T04:31:28.520639Z DEBUG dsc_lib::dscresources::command_resource: 699: Invoking command 'powershell' with args Some(["-NoLogo", "-NonInteractive", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", "$Input | ./psDscAdapter/powershell.resource.ps1 Get"])
2025-07-24T04:31:28.525191Z TRACE dsc_lib::dscresources::command_resource: 616: Writing to command STDIN: {"resources":[{"name":"AccessControlDSC/NTFSAccessEntry","type":"AccessControlDSC/NTFSAccessEntry","properties":{"Path":"c:\\temp\\test","AccessControlList":[{"Principal":"Everyone","AccessControlEntry":[{"AccessControlType":"Allow","FileSystemRights":"FullControl","Inheritance":"This folder and files","Ensure":"Present"}]}]}}],"metadata":{"Microsoft.DSC":{"context":"configuration"}}}
2025-07-24T04:31:28.793046Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496: PSVersion=5.1.26100.4652
2025-07-24T04:31:28.793962Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496: PSPath=C:\Windows\System32\WindowsPowerShell\v1.0
2025-07-24T04:31:28.794275Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496: PSModulePath=C:\Users\Thomas\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7-preview\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
2025-07-24T04:31:28.799464Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496: jsonInput={"resources":[{"name":"AccessControlDSC/NTFSAccessEntry","type":"AccessControlDSC/NTFSAccessEntry","properties":{"Path":"c:\\temp\\test","AccessControlList":[{"Principal":"Everyone","AccessControlEntry":[{"AccessControlType":"Allow","FileSystemRights":"FullControl","Inheritance":"This folder and files","Ensure":"Present"}]}]}}],"metadata":{"Microsoft.DSC":{"context":"configuration"}}}
2025-07-24T04:31:28.966549Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496: Reading from Get-DscResource cache file C:\Users\Thomas\AppData\Local\dsc\WindowsPSAdapterCache.json
2025-07-24T04:31:29.002836Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496: Checking cache for stale PSModulePath
2025-07-24T04:31:29.021851Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496: PSModulePath diff ''
2025-07-24T04:31:29.022739Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496: Checking cache for stale entries
2025-07-24T04:31:29.078800Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496: OS version: Microsoft Windows NT 10.0.26100.0
2025-07-24T04:31:29.079753Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496: PowerShell version: 5.1.26100.4652
2025-07-24T04:31:29.081659Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496: PSDesiredStateConfiguration module version: 1.1
2025-07-24T04:31:29.096396Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496: DSC resource implementation: ScriptBased
2025-07-24T04:31:29.125143Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496: Module: AccessControlDSC, Name: NTFSAccessEntry, Property: {"Path":"c:\\temp\\test","AccessControlList":[{"Principal":"Everyone","AccessControlEntry":""}]}
2025-07-24T04:31:29.303209Z DEBUG dsc_lib::dscresources::command_resource: 902: PID 27496:

Message        : Failed to serialize properties into CimInstance.
Data           : {}
InnerException :
TargetSite     : Microsoft.Management.Infrastructure.CimInstance SerializeIntoCimInstance(System.Management.Automation.Language.DynamicKeyword, Microsoft.PowerShell.Commands.ModuleSpecification, System.Collections.Hashtable)
StackTrace     :    at Microsoft.PowerShell.DesiredStateConfiguration.Commands.InvokeDscResourceMethodCommand.SerializeIntoCimInstance(DynamicKeyword resourceInfo, ModuleSpecification moduleSpecification, Hashtable property)
                    at Microsoft.PowerShell.DesiredStateConfiguration.Commands.InvokeDscResourceMethodCommand.CreateParametersCollection()
                    at Microsoft.PowerShell.DesiredStateConfiguration.Commands.InvokeDscResourceMethodCommand.ProcessRecord()
                    at System.Management.Automation.CommandProcessor.ProcessRecord()
HelpLink       :
Source         : Microsoft.Windows.DSC.CoreConfProviders
HResult        : -2146233076




2025-07-24T04:31:29.304567Z ERROR dsc_lib::dscresources::command_resource: 896: PID 27496: Exception: Failed to serialize properties into CimInstance.
2025-07-24T04:31:29.322548Z DEBUG dsc_lib::dscresources::command_resource: 660: Process 'powershell' id 27496 exited with code 1
2025-07-24T04:31:29.323978Z ERROR dsc::subcommand: 75: Command: Resource 'powershell' [exit code 1] manifest description: Error
Environment data
7.6-preview4
Version

3.2.-preview3

Visuals

No response

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.