1

我正在使用 VSTS 发布管理。第一步是进行“Windows 机器文件复制”。设置如下。执行 robocopy 并显示“拒绝访问”错误消息时,此操作会失败。以下设置中显示的文件路径将转换为 \\machine\e$\xxxx\TargetFolder。为什么我的访问被拒绝?如果我在目标文件夹上创建共享文件夹并将目标文件夹更改为:\\machine\TargetFolder,我不会收到此消息。Admin 用户是机器上的本地管理员。

我的问题是为什么我需要设置一个共享文件夹才能让它工作。为什么不能使用管理员共享(即\\machine\e$\xxxx\TargetFolder)

在此处输入图像描述

这是日志。源服务器和目标服务器都是 Win 2012R2 服务器。目标服务器上的 UAC 已关闭。我试过 /B 和 /ZB 作为参数,但没有奏效。

2017-02-20T12:21:10.4545267Z Downloading artifact
2017-02-20T12:21:11.4375965Z Cleaning artifacts directory: C:\VSTS_agent\ReleaseManagementVSTS\r1\a
2017-02-20T12:21:11.6306012Z Cleaned artifacts directory: C:\VSTS_agent\ReleaseManagementVSTS\r1\a
2017-02-20T12:21:11.6396014Z Starting artifacts download...
2017-02-20T12:21:11.6426015Z Downloading linked artifact Release Build of type Build...
2017-02-20T12:21:11.6486018Z Ensuring artifact folder C:\VSTS_agent\ReleaseManagementVSTS\r1\a\Release Build exists and is clean.
2017-02-20T12:21:11.6856039Z Preparing to get the list of available artifacts from build
2017-02-20T12:21:12.0926382Z Preparing to download artifact: release
2017-02-20T12:21:12.1066374Z Artifact Type: ServerDrop
2017-02-20T12:21:12.5536635Z Caching items under 'release' in the file container...
2017-02-20T12:21:12.7186787Z Caching complete. (165 ms)
2017-02-20T12:21:17.8480056Z Download complete.
2017-02-20T12:21:17.8500047Z 51 placed file(s): 51 downloaded, 0 empty
2017-02-20T12:21:17.8500047Z 11 MB downloaded at 2188 KB/sec. Download time: 00:00:05.0976254. Parallel download limit: 4.
2017-02-20T12:21:17.8510054Z Downloaded linked artifact Release Build
2017-02-20T12:21:17.8510054Z Finished artifacts download
2017-02-20T12:21:17.8610039Z ##[section]Finishing: Download Artifacts
2017-02-20T12:21:17.8690051Z ##[section]Starting: Copy files from $(System.DefaultWorkingDirectory)/Release Build/release
2017-02-20T12:21:17.9680113Z ==============================================================================
2017-02-20T12:21:17.9680113Z Task         : Windows Machine File Copy
2017-02-20T12:21:17.9680113Z Description  : Copy files to remote machine(s)
2017-02-20T12:21:17.9690126Z Version      : 1.0.39
2017-02-20T12:21:17.9690126Z Author       : Microsoft Corporation
2017-02-20T12:21:17.9690126Z Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=627415)
2017-02-20T12:21:17.9690126Z ==============================================================================
2017-02-20T12:21:18.0380182Z Preparing task execution handler.
2017-02-20T12:21:19.8101219Z Executing the powershell script: C:\VSTS_agent\ReleaseManagementVSTS\_tasks\WindowsMachineFileCopy_xxxx\1.0.39\WindowsMachineFileCopy.ps1
2017-02-20T12:21:24.0233892Z Copy started for - 'machine'
2017-02-20T12:21:28.8116953Z 
2017-02-20T12:21:28.8116953Z -------------------------------------------------------------------------------
2017-02-20T12:21:28.8116953Z    ROBOCOPY     ::     Robust File Copy for Windows                              
2017-02-20T12:21:28.8116953Z -------------------------------------------------------------------------------
2017-02-20T12:21:28.8116953Z 
2017-02-20T12:21:28.8146952Z   Started : Monday, February 20, 2017 7:21:28 AM
2017-02-20T12:21:28.8156949Z 2017/02/20 07:21:28 ERROR 5 (0x00000005) Getting File System Type of Destination \\machine\E$\xxx\TargetFolder\
2017-02-20T12:21:28.8156949Z Access is denied.
2017-02-20T12:21:28.8156949Z 
2017-02-20T12:21:28.8156949Z 
2017-02-20T12:21:28.8156949Z    Source : C:\VSTS_agent\ReleaseManagementVSTS\r1\a\Release Build\release\
2017-02-20T12:21:28.8167052Z      Dest - \\machine\E$\xxx\TargetFolder\
2017-02-20T12:21:28.8167052Z 
2017-02-20T12:21:28.8167052Z     Files : *.*
2017-02-20T12:21:28.8167052Z        
2017-02-20T12:21:28.8167052Z   Options : *.* /S /E /DCOPY:DA /COPY:DAT /R:1000000 /W:30 
2017-02-20T12:21:28.8167052Z 
2017-02-20T12:21:28.8167052Z ------------------------------------------------------------------------------
2017-02-20T12:21:28.8186939Z 
2017-02-20T12:21:28.8196951Z 2017/02/20 07:21:28 ERROR 5 (0x00000005) Creating Destination Directory \\machine\E$\xxx\TargetFolder\
2017-02-20T12:21:28.8196951Z Access is denied.
2017-02-20T12:21:28.8196951Z 
2017-02-20T12:21:28.8977003Z \\machine was deleted successfully.
2017-02-20T12:21:28.8977003Z 
2017-02-20T12:21:28.9177039Z ##[error]System.Management.Automation.RuntimeException: Copying failed for resource : machine
2017-02-20T12:21:28.9177039Z Copying failed. Consult the robocopy logs for more details. ---> System.Management.Automation.RuntimeException: Copying failed for resource : machine
2017-02-20T12:21:28.9177039Z Copying failed. Consult the robocopy logs for more details.
2017-02-20T12:21:28.9177039Z    --- End of inner exception stack trace ---
2017-02-20T12:21:28.9177039Z    at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
2017-02-20T12:21:28.9177039Z    at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
2017-02-20T12:21:28.9177039Z    at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
2017-02-20T12:21:28.9177039Z    at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-02-20T12:21:28.9177039Z    at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-02-20T12:21:28.9187021Z    at Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.Main(String[] args)
2017-02-20T12:21:28.9407042Z ##[error]LegacyVSTSPowerShellHost.exe completed with return code: -1.
2017-02-20T12:21:28.9427038Z ##[section]Finishing: Copy files from $(System.DefaultWorkingDirectory)/Release Build/release
2017-02-20T12:21:28.9507042Z ##[section]Finishing: Release
4

1 回答 1

3

此问题已通过使用 Active Directory 帐户得到解决。这解决了无法使用管理员共享进行 Robocopy 的问题。这适用于 AD 用户有权访问的机器,以及 AD 无权访问但设置了与 AD 帐户同名的本地管理员 windows 帐户的机器。

于 2017-02-25T13:05:56.950 回答