Powershell DSC,输出MOF到不同的文件夹

时间:2018-05-21 21:09:47

标签: powershell dsc

鉴于这个简单的配置文件:

Configuration MyDscConfiguration {

    Node "TEST-PC1" {
        WindowsFeature MyFeatureInstance {
            Ensure = "Present"
            Name =  "RSAT"
        }
        WindowsFeature My2ndFeatureInstance {
            Ensure = "Present"
            Name = "Bitlocker"
        }
    }
}
MyDscConfiguration

运行时,为节点“TEST-PC1”生成的MOF文件将放在名为MyDscConfiguration的子目录中。

我正在寻找一种方法将MOF输出到自定义目录位置,例如mofs\MyDscConfiguration\

这可能吗?

1 个答案:

答案 0 :(得分:6)

是的,您的配置有一个-OutputPath参数,您可以给它。

配置本质上是功能和工作方式大致相同。

您甚至可以使用Get-Help MyDscConfiguration查看它拥有的所有参数(您也可以使用它定义自己的param()块,就像使用函数一样)。

TAB 完成也有效,因此这是发现params的快捷方法。