WindowsFeatureSet 上的调用 DscResource 失败

Invoke-DscResource on WindowsFeatureSet fails

在 WindowsFeatureSet 上调用 Invoke-DSCResource 失败并出现奇怪错误。

Invoke-DscResource -Name WindowsFeatureSet -Property @{Name = 'FileAndStorage'; Ensure = 'Present' } -Method test -ModuleName PSDesiredStateConfiguration

Invoke-DscResource : Failed to serialize properties into CimInstance. At line:5 char:1 + Invoke-DscResource -Name WindowsFeatureSet -Property @{Name = 'FileAn ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Invoke-DscResource], SerializationException + FullyQualifiedErrorId : System.Runtime.Serialization.SerializationException,Microsoft.PowerShell.DesiredStateConfiguration.Commands.InvokeDscResourceMethodCommand

这是一个已知问题。有an issue filed in PowerShell User Voice, which is marked as 'Survey'. 'Survey' indicates 'We saw this and we are considering it...' per the PowerShell User Voice Home Page.

这也记录在 Chef Discourse here 中。

[此处] 更新 Chef 文档存在未决问题(https://github.com/chef/chef-web-docs/issues/59) and DSC Documentation here

LCM 从不加载复合配置。它们仅在编译期间使用,生成的 mof 将复合配置解析为其底层资源。所以这预计不会奏效。您可以尝试使用 'WindowsFeature' 代替。此博客解释了 DSC 中的复合资源 http://nanalakshmanan.com/blog/Composite-Resources-Explained/