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

Bre*_*ski 4 powershell dsc

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

Configuration MyDscConfiguration {

    Node "TEST-PC1" {
        WindowsFeature MyFeatureInstance {
            Ensure = "Present"
            Name =  "RSAT"
        }
        WindowsFeature My2ndFeatureInstance {
            Ensure = "Present"
            Name = "Bitlocker"
        }
    }
}
MyDscConfiguration
Run Code Online (Sandbox Code Playgroud)

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

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

这可能吗?

bri*_*ist 6

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

从本质上讲,配置功能和工作方式大致相同.

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

TAB 完成工作也是如此,这是发现参数的快速方法.