I am trying to update some specfifc files in one directory using DSC File Resource. The files I want to update (i.e. overwrite) in my example are present in the destination, but empty (0KB). The files in the source have exactly the same name but have some content. Using below code, the contents of the source files are not copied to the destination files. Any idea why? Thanks in advance.
Ensure = "Present"
Type = "File"
Force = $true
SourcePath = "somepath\myfile.txt"
DestinationPath = "anotherpath\myfile.txt"
As per the answer of a similar question here: you probably want to try adding checksum = 'modifiedDate'
and matchsource = $true
to your properties.
The official doc has moved since the answer to the other question.
File TheFile {
Ensure = "Present"
Type = "File"
Force = $true
SourcePath = "somepath\myfile.txt"
DestinationPath = "anotherpath\myfile.txt"
checksum = 'modifiedDate'
matchsource = $true
}