Tagged: DSC File Resource
July 18, 2016 at 6:45 am #47269
I need a certain functionality that is currently missing from the built in DSC File Resource. Before I start to make a custom module for it I wanted to check if someone has a better solution to it.
Here is what I need.
I have a network share that has a folder with files A and B and I need to make an exact copy of that folder on the server.
When I add a new file called C, then it needs to be copied on the server the next time a configuration is applied. I configured the MatchSource property to $true and everything is ok. So far so good.
Now to the problem. I want to be able to remove file B on the file share and it to be removed from the target folder as well so that only A and C are in it.
- This topic was modified 1 year, 2 months ago by Stan Hristov.
July 18, 2016 at 6:54 am #47272
Sounds to me like you should probably be setting up DFS replication, or something similar. The DSC file resource is not efficient at all for this; even if it did what you wanted, it would be copying down the entire contents of the remote share every time you applied a new config.
July 18, 2016 at 8:23 am #47283
Thank you for your fast reply.
I really don't want to use DFS. One of the reasons (not the primary one) is that the source folder on the file share is different (most of the files inside are the same) and I don't want to reconfigure the DFS replication group settings each time and wait for the changes to take effect.
Why it will be coping all files every time? If I use some checksum and the files are identical wouldn't it skip them?
July 18, 2016 at 8:29 am #47285
The DSC file resource has to copy the files down before it can calculate their checksum. It does this into a temporary cache folder on your local disk. This cache is wiped out every time you apply a new configuration.
The only time checksums can help you cut down on network traffic is if a copy of the checksum is pre-calculated and stored on the remote server along with the actual file. Then your client could download just the checksum first (smaller size, generally), and only grab the whole file if it needs to.
July 18, 2016 at 8:36 am #47287
I see, I will think of another solution then perhaps not DSC for this part of our environment setup.
Thank you very much.
You must be logged in to reply to this topic.