Windows Machine File Copy won't work without shared folder

1

I am using VSTS Release Management. The first step is to do a "Windows Machine File Copy". The settings are below. This fails when doing the robocopy with an error message of "Access Denied". The file path shown in the settings below gets translated to \\machine\e$\xxxx\TargetFolder. Why am I getting access denied? I don't get this message if I create a shared folder on the target folder and change the destination folder to: \\machine\TargetFolder. The Admin user is a local admin on the machine.

My question is why do I need to setup a shared folder in order to get this to work. Why can't it use the admin share (i.e. \\machine\e$\xxxx\TargetFolder)

enter image description here

Here is the log. The source and destination servers are both Win 2012R2 servers. UAC is turned off on the destination server. I have tried /B and /ZB as arguments and that didn't work.

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
robocopy
azure-pipelines-release-pipeline
asked on Stack Overflow Feb 17, 2017 by Pragmatic Coder • edited Feb 20, 2017 by Pragmatic Coder

1 Answer

3

This issue was resolved by using an Active Directory account. This fixed the issue of not being able to Robocopy with the admin share. This worked on machines that the AD user had access, and for machines where the AD didn't have access but where a local admin windows account was setup with the same name as the AD account.

answered on Stack Overflow Feb 25, 2017 by Pragmatic Coder

User contributions licensed under CC BY-SA 3.0