我正在使用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修改文件,我希望目标文件也应该更新。
答案 0 :(得分: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
}