You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$PSInvokeParams=@{
Method='Get'Module='psdsc.repro'Name='ReproResultEnums'Property=@{ KeyProperty='Repro Example (PSDSC)' }
}
$PSInvokeResult=Invoke-DscResource@PSInvokeParams$PSInvokeResult|Format-List
KeyProperty : Repro Example (PSDSC)EnumProperty : Foo
Invoke the resource with dsc resource:
'{ "KeyProperty": "Repro Example (DSCv3)" }'|
dsc resource get -r psdsc.repro/ReproResultEnums |ConvertFrom-Json|Select-Object-ExpandProperty actualState
$V3InvokeResult|Format-List
KeyProperty : Repro Example (DSCv3)EnumProperty : 0
Expected behavior
$invoking=@{
Method='Get'Module='psdsc.repro'Name='ReproResultEnums'Property=@{ KeyProperty='Repro Example (PSDSC)' }
}
$Invoke-DscResource @invoking|Format-List
KeyProperty : Repro Example (PSDSC)EnumProperty : Foo
$invoking.Property|ConvertTo-Json|
dsc resource get -r "$($invoking.Module)/$($invoking.Name)"|ConvertFrom-Json|Select-Object-ExpandProperty actualState |Format-List
KeyProperty : Repro Example (DSCv3)EnumProperty : Foo
Actual behavior
$invoking=@{
Method='Get'Module='psdsc.repro'Name='ReproResultEnums'Property=@{ KeyProperty='Repro Example (PSDSC)' }
}
$Invoke-DscResource @invoking|Format-List
KeyProperty : Repro Example (PSDSC)EnumProperty : Foo
$invoking.Property|ConvertTo-Json|
dsc resource get -r "$($invoking.Module)/$($invoking.Name)"|ConvertFrom-Json|Select-Object-ExpandProperty actualState |Format-List
KeyProperty : Repro Example (DSCv3)EnumProperty : 0
Error details
No response
Environment data
Name Value
---------
PSVersion 7.3.6
PSEdition Core
GitCommitId 7.3.6
OS Microsoft Windows 10.0.22621
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Version
DSC (build from main), PSDSC v2.0.7
Visuals
No response
Fix Proposal
The return data handling by the DSC/PowerShellGroup resource provider is to just convert the result data to JSON:
Prerequisites
Steps to reproduce
Create the files for a new PowerShell module
Define the module manifest:
Define the root module script:
Add the folder containing the repro module to the
PSModulePath
:Confirm you can get the
ReproResultEnums
dsc resource and see its properties:Invoke the resource with
Invoke-DscResource
Invoke the resource with
dsc resource
:Expected behavior
Actual behavior
Error details
No response
Environment data
Version
DSC (build from main), PSDSC v2.0.7
Visuals
No response
Fix Proposal
The return data handling by the
DSC/PowerShellGroup
resource provider is to just convert the result data to JSON:DSC/powershellgroup/powershellgroup.resource.ps1
Line 179 in 6b286f1
Adding the EnumsAsStrings switch parameter to the
ConvertTo-Json
call ensures the enums are converted correctly.The text was updated successfully, but these errors were encountered: