DSC文件资源 - 复制文件

3
我正在使用PowerShell DSC Pull Server。 是否可以使用文件资源在每次修改时复制文件? 我已尝试以下操作:
        File Test{
        DestinationPath = "c:\yyy\test.txt"
        SourcePath = "\\share\test.txt"
        Ensure = "Present"
        Type = "File"
        Credential = $Credential
        Checksum = "modifiedDate"
        Force = $true}

但是没有运气:如果我修改了SourcePath中的文件,我期望目标文件也应该被更新。
1个回答

4

添加MatchSource,请参阅此处的文档。

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接