Powershell DSC文件资源-复制文件

Powershell DSC文件资源-复制文件,powershell,dsc,Powershell,Dsc,我正在使用PowerShell DSC拉式服务器。 是否可以在每次修改文件时使用文件资源复制文件? 我尝试了以下方法: File Test{ DestinationPath = "c:\yyy\test.txt" SourcePath = "\\share\test.txt" Ensure = "Present" Type = "File" Credential = $Credential

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

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

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

添加MatchSource,请参阅文档

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