我正在使用 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,参见文档 here .
File Test{
DestinationPath = "c:\yyy\test.txt"
SourcePath = "\\share\test.txt"
Ensure = "Present"
Type = "File"
Credential = $Credential
Checksum = "modifiedDate"
Force = $true
MatchSource = $true
}
关于powershell - DSC 文件资源 - 复制文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33233031/