Skip to content

DSC seems to inject "Verbose" key into resource properties, causing an error when "Verbose" is not a property in the DSC resource schema file #1296

@ljoldfield

Description

@ljoldfield

Prerequisites

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

Summary

Attempting to test deploy a microsoft365DSC resource: "Microsoft365DSC/IntuneDeviceConfigurationPlatformScriptWindows"

Fails with an error stating:

Exception: The PowerShell DSC resource  returned results that are not valid from Get-TargetResource.
The Verbose key is not a valid property in the corresponding DSC resource schema file. The results
from Get-TargetResource must be in a Hashtable format. The keys in the Hashtable must be the same as
the properties in the corresponding DSC resource schema file.

I haven't added the key "Verbose", it seems to be a default behaviour of the adapter that I can't turn off.

Steps to reproduce

  1. Write config document, no Verbose key included:

    $schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
    resources:
      - name: Intune Test
        type: Microsoft.Windows/WindowsPowerShell
        properties:
          resources:
            - name: Test-Intune-Script
              type: Microsoft365DSC/IntuneDeviceConfigurationPlatformScriptWindows
              properties:
                Id: "34cedb35-7569-4d20-acbc-81c12c2d9507"
                DisplayName: "TestCustomScript"
                Ensure: "Present"
                EnforceSignatureCheck: false
                FileName: "test-dsc.ps1"
                RunAs32Bit: false
                RunAsAccount: "system"
                ScriptContent: "test"
                ApplicationId: "###"
                TenantId: "###"
                CertificateThumbprint: "###"
  2. Attempt to deploy using:

    dsc -l trace config set --file .\test.yml
  3. Check M365DSC Event Log, sure enough the verbose key appears:

    <M365DSCEvent>
        <ConfigurationDrift Source="MSFT_IntuneDeviceConfigurationPlatformScriptWindows" TenantId="wgadev.onmicrosoft.com">
            <ParametersNotInDesiredState>
                <Param Name="Ensure"><CurrentValue>Absent</CurrentValue><DesiredValue>Present</DesiredValue></Param>
                <Param Name="Ensure"><CurrentValue>Absent</CurrentValue><DesiredValue>Present</DesiredValue></Param>
            </ParametersNotInDesiredState>
        </ConfigurationDrift>
        <DesiredValues>
            <Param Name ="DisplayName">TestCustomScript</Param>
            <Param Name ="EnforceSignatureCheck">False</Param>
            <Param Name ="FileName">test-dsc.ps1</Param>
            <Param Name ="RunAs32Bit">False</Param>
            <Param Name ="RunAsAccount">system</Param>
            <Param Name ="ScriptContent">test</Param>
            <Param Name ="Id">34cedb35-7569-4d20-acbc-81c12c2d9507</Param>
            <Param Name ="Ensure">Present</Param>
            <Param Name ="ApplicationId">###</Param>
            <Param Name ="TenantId">###</Param>
            <Param Name ="CertificateThumbprint">###</Param>
            <Param Name ="Verbose">True</Param>
        </DesiredValues>
        <CurrentValues>
            <Param Name ="EnforceSignatureCheck">False</Param>
            <Param Name ="ScriptContent">test</Param>
            <Param Name ="FileName">test-dsc.ps1</Param>
            <Param Name ="RunAsAccount">system</Param>
            <Param Name ="Id">34cedb35-7569-4d20-acbc-81c12c2d9507</Param>
            <Param Name ="Verbose">True</Param>
            <Param Name ="ApplicationId">###</Param>
            <Param Name ="DisplayName">TestCustomScript</Param>
            <Param Name ="Ensure">Absent</Param>
            <Param Name ="CertificateThumbprint">###</Param>
            <Param Name ="RunAs32Bit">False</Param>
            <Param Name ="TenantId">###</Param>
        </CurrentValues>
    </M365DSCEvent>

Expected behavior

dsc -l debug config set --file .\test.yml

results:
 - name: Intune Test
   type: Microsoft.Windows/WindowsPowerShell
   result: 
     actualState:
       output: not sure..
messages: []
hadErrors: false

Actual behavior

NativeErrorCode : TypeMismatch
ErrorData       : MSFT_WmiError
MessageId       : GetOperationResultInvalidResultFormat
ErrorSource     :
ErrorType       : 0
StatusCode      : 13
Message         : The PowerShell DSC resource  returned results that are not valid from 
                  Get-TargetResource. The Verbose key is not a valid property in the corresponding
                  DSC resource schema file. The results from Get-TargetResource must be in a Hashtable
                  format. The keys in the Hashtable must be the same as the properties in the
                  corresponding DSC resource schema file.
Data            : {}
InnerException  :
TargetSite      : Void ProcessNativeCallback(Microsoft.Management.Infrastructure.Native.OperationCallbackProcessingContext,
                  T, Boolean, Microsoft.Management.Infrastructure.Native.MiResult, System.String, Microsoft.Management.
                  Infrastructure.Native.InstanceHandle)
StackTrace      :    at Microsoft.Management.Infrastructure.Internal.Operations.CimAsyncObserverProxyBase`1.ProcessNativeCallback
                  (OperationCallbackProcessingContext callbackProcessingContext, T currentItem,
                  Boolean moreResults, MiResult operationResult, String errorMessage, InstanceHandle
                  errorDetailsHandle)
HelpLink        :
Source          : Microsoft.Management.Infrastructure
HResult         : -2146233088


2025-11-28T05:54:26.367258Z ERROR dsc_lib::dscresources::command_resource: 896: PID 31112: Exception:
    The PowerShell DSC resource  returned results that are not valid from Get-TargetResource. The
    Verbose key is not a valid property in the corresponding DSC resource schema file. The results
    from Get-TargetResource must be in a Hashtable format. The keys in the Hashtable must be the
    same as the properties in the corresponding DSC resource schema file.
2025-11-28T05:54:26.441405Z DEBUG dsc_lib::dscresources::command_resource: 660: Process 'powershell'
    id 31112 exited with code 1
2025-11-28T05:54:26.446813Z ERROR dsc::subcommand: 106: Error: Command: Resource 'powershell'
    [exit code 1] manifest description: Error

Error details

2025-11-28T05:45:31.683970Z ERROR dsc_lib::dscresources::command_resource: 896: PID 33424: Exception:
    The PowerShell DSC resource  returned results that are not valid from Get-TargetResource. The
    Verbose key is not a valid property in the corresponding DSC resource schema file. The results
    from Get-TargetResource must be in a Hashtable format. The keys in the Hashtable must be the
    same as the properties in the corresponding DSC resource schema file.
2025-11-28T05:45:31.763039Z DEBUG dsc_lib::dscresources::command_resource: 660: Process 'powershell'
    id 33424 exited with code 1
2025-11-28T05:45:31.769200Z ERROR dsc::subcommand: 106: Error: Command: Resource 'powershell'
    [exit code 1] manifest description: Error

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.4
PSEdition                      Core
GitCommitId                    7.5.4
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.2.0-preview.2

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions