【问题标题】:Powershell DSC, Output MOF to different folderPowershell DSC,将 MOF 输出到不同的文件夹
【发布时间】:2018-05-21 21:09:46
【问题描述】:

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

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\

这可能吗?

【问题讨论】:

    标签: powershell dsc


    【解决方案1】:

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

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

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

    TAB 补全也有效,因此这是发现参数的快速方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-19
      • 2017-03-28
      • 1970-01-01
      • 1970-01-01
      • 2018-06-25
      相关资源
      最近更新 更多