I am trying to use PowerShell DSC to copy folder contents from a network share. Here is the code:
Configuration TestSetup { Node localhost { File Test { SourcePath = "\\Server\SomeShare\SomeFolder" DestinationPath = "E:\test" Recurse = $true Type = "Directory" } } }
This doesn't work however - when I run it I get the following error message:
The related file/directory is: \\Server\SomeShare\SomeFolder. The path cannot point to the root directory or to the root of a net share. SourcePath must be specified if you want to configure the destination directory recursively. Make sure that SourcePath is a directory and that it is accessible. + CategoryInfo : InvalidArgument: (:) [], CimException + FullyQualifiedErrorId : MI RESULT 4 + PSComputerName : localhost The SendConfigurationApply function did not succeed. + CategoryInfo : InvalidArgument: (root/Microsoft/...gurationManager:String) [], CimException + FullyQualifiedErrorId : MI RESULT 4 + PSComputerName : localhost
I get similar results when trying to install a package from a network share or extract an archive from a network share. I'm running PowerShell 4 on Windows Server 2008 R2 SP1.
Is there a way to use PowerShell DSC with network shares?