【问题标题】:DSC File Resource - copy fileDSC 文件资源 - 复制文件
【发布时间】:2015-10-20 09:33:46
【问题描述】:

我正在使用 PowerShell DSC 拉取服务器。 每次修改文件时都可以使用文件资源来复制文件吗? 我尝试了以下方法:

        File Test{
        DestinationPath = "c:\yyy\test.txt"
        SourcePath = "\\share\test.txt"
        Ensure = "Present"
        Type = "File"
        Credential = $Credential
        Checksum = "modifiedDate"
        Force = $true}

但没有运气:如果我从 SourcePath 修改文件,我希望目标文件也应该更新。

【问题讨论】:

    标签: powershell dsc


    【解决方案1】:

    添加 MatchSource,请参阅文档 here

        File Test{
            DestinationPath = "c:\yyy\test.txt"
            SourcePath = "\\share\test.txt"
            Ensure = "Present"
            Type = "File"
            Credential = $Credential
            Checksum = "modifiedDate"
            Force = $true
            MatchSource = $true
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多