2015-10-20 84 views
2

我正在使用PowerShell DSC拉服務器。 每次修改都可以使用文件資源來複制文件? 我已經試過以下:DSC文件資源 - 複製文件

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

,但沒有運氣:如果我從SOURCEPATH修改文件我期望的目標文件也應該被更新。

回答

2

添加Match源文件,見文檔here

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