DSC文件资源 - 复制文件

问题描述 投票:3回答:1

我正在使用PowerShell DSC Pull Server。每次修改时都可以使用File资源复制文件?我试过以下:

        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个回答
4
投票

添加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
    }
© www.soinside.com 2019 - 2024. All rights reserved.