I have been trying to use File resource inside foreach loop for multiple sourcepath and single destination but it errors out stating that:
Resources have identical key properties but there are differences in the following non-key properties: 'SourcePath'. Values '\\IM' don't match values '\\PowerShellGallery'. Please update these property values so that they are identical in both cases.
In this sample, $ModulesDirectory is UNC containing 2 nested folders IM and PowerShellGallery. I want to pull down files from UNC path into local drive. In future there may be multiple folders under $ModulesDirectory root dir.
Every resource defines specific properties that are its "keys," and each instance of that resource must have a unique key. I'm not in front of a computer to check, but I believe for the File resource it's DestinationPath. You can't have multiple blocks with the same DestinationPath.