【问题标题】:DSC does not install GitDSC 不安装 Git
【发布时间】:2016-02-09 01:22:56
【问题描述】:

我正在尝试使用 DSC 在 Windows 7 上使用 PowerShell 4.0 安装 Git,基于:

https://justingalston.wordpress.com/2014/06/11/using-powershell-desired-state-configuration-to-check-for-and-install-applications/

Configuration InstallApps
{

  Node localhost
  {
    Package Git
    {
        Ensure = "Present"
        Name = "Git"
        Path = "C:\tmp\Git-2.7.0.2-64-bit.exe"
        ProductId = ''
    }
  }
}
InstallApps

我运行上述脚本的机器上没有安装 Git。

当我运行上面的 git 时,没有安装,而是在文件夹 InstallApps 中创建了一个 localhost.mof 文件:

Mode                LastWriteTime     Length Name                                                                      
----                -------------     ------ ----                                                                      
-a---        05-02-2016     11:35       1292 localhost.mof                                                             


[Finished in 2.4s]

为什么没有触发安装?

【问题讨论】:

    标签: git powershell dsc


    【解决方案1】:

    我还没有阅读您引用的博客,但是运行上述函数只会创建 mof 文件。

    为了运行 mof 文件并执行所需的状态,您需要运行 Start-DscConfiguration cmdlet。类似于以下内容...

    Start-DscConfiguration -ComputerName TargetMachine -Path GeneratedMofFileLocation -Wait -Verbose
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-31
      • 1970-01-01
      • 2018-10-14
      相关资源
      最近更新 更多