Reputation: 101
I am trying to copy all the files within my source folder in a TFS collection to a VM that I have set up. The VM has a shared folder I can access within the file explorer by typing \\*IPAddress*\share
(where IPAddress is the IP of the VM).
Source Folder
section I have added the folder that I wish to copy. Contents
section I have left it as **
to get each file within the Source Folder
Target Folder
I have put the address that I can navigate to within the file explorer : \\*IPAddress*\share
(where IPAddress is the IP of the VM)When I queue the build and run it I get the following error:
Unable to create directory '\\*IPAddress*\share'. Unable to verify the directory exists: '\\*IPAddress*\share'. If directory is a file share, please verify the share name is correct, the share is online, and the current process has permission to access the share.
When I hover of the the little "I" next to target folder it states that it can be a UNC Path, so I know I'm able to copy the files but I'm not sure if I'm referencing the share folder correctly.
How would I reference this? One thing that may also be giving an issue is that when I navigate to the share from the File Explorer I have to enter credentials to access the share folder, so maybe it doesn't have permission to access the share because of this.
Upvotes: 0
Views: 1297
Reputation: 30432
Tested and Windows Machine File Copy
task works for me with providing the credential to access the shared path.
For Copy Files
task, you can try to grant the Read and Write permissions for the build agent service account (Which you specified during deploy the agent), then try it again.
Besides, you can also create a script to copy the files, then add a command line or PowerShell task to run the script.
For example, you can use below PowerShell script to copy the sources files with the specific username and password provided:
$Source = $env:BUILD_SOURCESDIRECTORY
$Dest = "\\172.17.16.115\CopyTest"
$Username = "domain\username"
$Password = ConvertTo-SecureString "PasswordHere" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential($Username, $Password)
New-PSDrive -Name J -PSProvider FileSystem -Root $Dest -Credential $mycreds -Persist
Copy-Item -Path $Source -Recurse -Force -Destination $Dest
Upvotes: 2