目前我有以下代码;
Configuration deployWebsite { param ( [string[]] $Machinename = "localhost" ) Node $Machinename { file Test { SourcePath = "\buildserver\mywebsite" DestinationPath = "C:\deployments" Recurse = $true Type = "Directory" } }}deployWebsite -Machinename "at-test-2012"
我运行这个,我能够生成一个很好的MOF文件.
我得到的错误如下;
PS C:\dsc> Start-DscConfiguration -Path .\deployWebsite -Cimsession $sess -Wait -Verbose -ForceVERBOSE: Perform operation 'Invoke CimMethod' with following parameters,''methodname' = SendConfigurationApply,'classname' = MSFT_DSCLocalConfigurationManager,'namespacename' = root/Microsoft/windows/DesiredStateConfiguration'.VERBOSE: An LCM method call arrived from computer AT-TEST-2012 with user sID S-1-5-21-77344112-180879520-4075690869-1002.VERBOSE: [AT-TEST-2012]: LCM: [ Start Set ]VERBOSE: [AT-TEST-2012]: LCM: [ Start Resource ] [[file]Test]VERBOSE: [AT-TEST-2012]: LCM: [ Start Test ] [[file]Test]VERBOSE: [AT-TEST-2012]: [[file]Test] Access is denIEd.VERBOSE: [AT-TEST-2012]: [[file]Test] The related file/directory is: \buildserver\mywebsite.VERBOSE: [AT-TEST-2012]: [[file]Test] The path cannot point to the root directory or to the root of a net share.VERBOSE: [AT-TEST-2012]: [[file]Test] The related file/directory is: \buildserver\mywebsite.VERBOSE: [AT-TEST-2012]: [[file]Test] 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.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 : at-test-2012The SendConfigurationApply function dID not succeed. + categoryInfo : InvalIDArgument: (root/Microsoft/...gurationManager:String) [],CimException + FullyQualifIEdErrorID : MI RESulT 4 + PSComputername : at-test-2012VERBOSE: Operation 'Invoke CimMethod' complete.VERBOSE: Time taken for configuration job to complete is 3.979 seconds
CIM会议似乎设置得很好.
PS C:\dsc> Get-CimsessionID : 1name : Cimsession1InstanceID : 7ae9cd9b-fc65-4879-94c1-ec9805479500Computername : at-test-2012Protocol : WSMAN
它是使用以下代码创建的;
$sess = New-Cimsession -cn at-test-2012 -Authentication Credssp -Credential $cred
它是通过工作组计算机上的本地管理员的用户传递的凭据,并且是尝试从中提取文件的域计算机上的本地用户.
如果我通过创建PSSession尝试另一个测试,并尝试复制文件然后它工作正常,我看到文件出现在工作组计算机上.
$cred = Get-Credential -Credential deployuser$sess = New-PSSession -cn at-test-2012 -Authentication Credssp -Credential $cred Invoke-Command -Session $sess -ScriptBlock {copy-Item -Path '\buildserver\mywebsite' -Destination 'C:\deployments'}
问题是Start-DscConfiguration似乎不支持PSSessions,只支持Cimsessions.
那么,关于下一步尝试的任何指示?我认为我的Cimsession设置正确,我认为我在文件共享,工作组机器上的所有必要设置都正确设置,因为PSSession工作正常.
干杯,
安迪
>使用显式创建远程计算机上的计划任务
凭证,在本地执行Start-DscConfiguration.它会运行
完全与本地用户一样,用于远程处理的下一跳.
>考虑创建和使用JEA端点.这更多
复杂,但让你走向简化的道路
正在进行的管理远程机器的凭证管理.
>您可以使用创建远程共享的映射驱动器
使用类似脚本资源的显式信用
如果您有其他可能影响网络变化的配置,请注意进行远程Start-DscConfiguration.
例如,通过JustEnoughadministration资源创建前面提到的JEA端点可以重置WinRM并过早地中断本地和远程Start-DscConfiguration调用-Wait.
计划任务不受影响配置中的网络影响,以及来自其他环境因素的简单网络剥落.最重要的是,如果您需要监控配置的稳定性,这是读者的练习(或未来的问题/答案).
总结以上是内存溢出为你收集整理的Powershell DSC文件复制 – 工作组机器全部内容,希望文章能够帮你解决Powershell DSC文件复制 – 工作组机器所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)