3

I'm using a PowerShell DSC Pull Server. It's possible to use the File resource to copy a file every time is modified? I've tried the below:

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

but no luck: if I modify the file from SourcePath I'd expect that the destination file should be updated too.

ds19
  • 3,176
  • 15
  • 33

1 Answers1

4

Add MatchSource, See documentation here.

    File Test{
        DestinationPath = "c:\yyy\test.txt"
        SourcePath = "\\share\test.txt"
        Ensure = "Present"
        Type = "File"
        Credential = $Credential
        Checksum = "modifiedDate"
        Force = $true
        MatchSource = $true
    }
Orangutech
  • 769
  • 1
  • 10
  • 17
TravisEz13
  • 2,263
  • 1
  • 20
  • 28