windows – 来自网络共享的PowerShell DSC副本
发布时间:2020-12-13 19:56:34 所属栏目:Windows 来源:网络整理
导读:我正在尝试使用Power Shell DSC从网络共享中复制文件夹内容.这是代码: Configuration TestSetup { Node localhost { File Test { SourcePath = "ServerSomeShareSomeFolder" DestinationPath = "E:test" Recurse = $true Type = "Directory" } }} 但这
我正在尝试使用Power
Shell DSC从网络共享中复制文件夹内容.这是代码:
Configuration TestSetup { Node localhost { File Test { SourcePath = "ServerSomeShareSomeFolder" DestinationPath = "E:test" Recurse = $true Type = "Directory" } } } 但这不起作用 – 当我运行它时,我收到以下错误消息: The related file/directory is: ServerSomeShareSomeFolder. 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用于网络共享?
DSC本地配置管理器作为本地SYSTEM帐户运行,而不是您的用户帐户.因此,除非获得明确的权限,否则它将无法访问网络资源.
有两种可能的情况.共享与应用DSC配置在同一台机器上(让我们称之为本机A)或共享在另一台机器上(让我们称之为本机B). 如果共享位于计算机A上,则需要向SYSTEM用户授予READ权限.例如: net share SomeShare=C:SomeShare /GRANT:"NT AUTHORITYSYSTEM",READ 如果共享位于计算机B上,则需要将READ权限授予计算机A的计算机帐户.例如: net share SomeShare=C:SomeShare /GRANT:DOMAINMachineA$,READ 资料来源:http://www.powershellmagazine.com/2013/09/02/copying-powershell-modules-and-custom-dsc-resources-using-dsc/ (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 安装 – 如何使用有效签名创建预先配置的安装程序(MSI或EXE
- group-policy – 通过GPP部署打印机时,驱动程序安装不起作用
- windows-server-2008 – 您使用Windows Server 2008 Server
- 如何判断win32 c应用程序在CTRL-ALT-DEL之后是否失去焦点?
- windows-8 – Moto X没有出现在Eclipse Windows 8.1中
- ASP木马Webshell安全解决方案
- windows – USB Stick上的Adobe Air App EXE
- 使用带有Ionic 2 Typescript的windows.plugins
- 用户界面 – 类似于RapidWeaver的windows编辑器
- 是否有一个Windows注册表“字典”,解释整个(或大部分)Windo
推荐文章
站长推荐
- Windows Phone 8.1和Windows Phone Silverlight
- windows-server-2008 – 重启域控制器的步骤?
- windows-server-2008-r2 – 为什么我的Server 20
- windows-server-2008-r2 – Windows 2008 Server
- Error: EACCES: permission denied, mkdir
- 无法在Windows7中运行conda install -c menpo op
- Windows API一日一练 19 DestroyWindow函数
- Windows – IIS6虚拟SMTP服务器在系统重新启动后
- Windows编程:从哪里开始?
- 如何以编程方式创建Microsoft Access数据库?
热点阅读