我正在尝试使用PowerShell DSC从网络共享复制文件夹内容。这是代码:
Configuration TestSetup {
Node localhost {
File Test {
SourcePath = "\\Server\SomeShare\SomeFolder"
DestinationPath = "E:\test"
Recurse = $true
Type = "Directory"
}
}
}
但是,这不起作用-当我运行它时,出现以下错误消息:
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
当尝试从网络共享中安装软件包或从网络共享中提取档案时,我得到类似的结果。我在Windows Server 2008 R2 SP1上运行PowerShell 4。
是否可以将PowerShell DSC与网络共享一起使用?