I hope this does not doublepost. Firefox is not likely the site today 🙁
It was my understanding that if no Checksum is used the fact that DestinationPath exists stops the copying of the file. But that is not what it's doing. it's recopying the file every time the destination file is changed.
My workaround for now is this.
Anyone know what I'm doing wrong?
It's hard to say, because File is one of the few resources that's implemented with binary code instead of PowerShell code. If I have time later, I'll try to track down which binary implements this resource and see how it works.
Based on the TechNet documentation: if you don't specify a value for the Checksum parameter, the File resource should be just using the file name to determine whether two files are the same. Is your $VHDFile variable set to 'BranchServer_Boot.vhdx', or something else? Maybe if you use different filenames for the source / destination, it causes the resource to see them as "different" every time it's applied.
I think your workaround is on the right track. You don't need to be downloading this file over and over again, except in situations where the whole VHD / VM needs to be rebuilt.
Edit: As a short-term workaround, assuming that $VHDFile is set to some name other than 'BranchServer_Boot.vhdx', you could possibly avoid this problem by setting up a folder structure where the files all have that name. This might make the File resource behave (which you can check.) You could also try setting the Checksum parameter to 'CreatedDate'.
You must be logged in to reply to this topic.