Deploy: Windows Machine File Copy

VSTS | TFS 2018 | TFS 2017 | TFS 2015

Note

Build and release pipelines are called definitions in TFS 2018 and in older versions. Service connections are called service endpoints in TFS 2018 and in older versions.

icon Copy files to remote machines.

Use this task to copy application files and other artifacts such as PowerShell scripts and PowerShell-DSC modules that are required to install the application on Windows Machines. It uses RoboCopy, the command-line utility built for fast copying of data.

YAML snippet

# Windows Machine File Copy
# Copy files to remote machine(s)
- task: WindowsMachineFileCopy@2
  inputs:
    sourcePath: 
    #machineNames: # Optional
    #adminUserName: # Optional
    #adminPassword: # Optional
    targetPath: 
    #cleanTargetBeforeCopy: false # Optional
    #copyFilesInParallel: true # Optional
    #additionalArguments: # Optional

Arguments

Argument Description
Source The path to the files to copy. Can be a local physical path such as c:\files or a UNC path such as \\myserver\fileshare\files. You can use pre-defined system variables such as $(Build.Repository.LocalPath) (the working folder on the agent computer), which makes it easy to specify the location of the build artifacts on the computer that hosts the automation agent.
Machines A comma-separated list of machine FQDNs or IP addresses, optionally including the port number. Can be:
- The name of an Azure Resource Group.
- A comma-delimited list of machine names. Example: dbserver.fabrikam.com, dbserver_int.fabrikam.com:5986,192.168.34:5986
- An output variable from a previous task.
Admin Login The username of either a domain or a local administrative account on the target host(s).
- Formats such as domain\username, username, and machine-name\username are supported.
- UPN formats such as username@domain.com and built-in system accounts such as NT Authority\System are not supported.
Password The password for the administrative account specified above. Consider using a secret variable global to the build or release pipeline to hide the password. Example: $(passwordVariable)
Destination Folder The folder on the Windows machine(s) to which the files will be copied. Example: C:\FabrikamFibre\Web
Advanced - Clean Target Set this option to delete all the files in the destination folder before copying the new files to it.
Advanced - Copy Files in Parallel Set this option to copy files to all the target machines in parallel, which can speed up the copying process.
Advanced - Additional Arguments Arguments to pass to the RoboCopy process. Example: /min:33553332 /l
Select Machines By Depending on how you want to specify the machines in the group when using the Filter Criteria parameter, choose Machine Names or Tags.
Filter Criteria Optional. A list of machine names or tag names that identifies the machines that the task will target. The filter criteria can be:
- The name of an Azure Resource Group.
- An output variable from a previous task.
- A comma-delimited list of tag names or machine names.
Format when using machine names is a comma-separated list of the machine FDQNs or IP addresses.
Specify tag names for a filter as {TagName}:{Value} Example: Role:DB;OS:Win8.1
Control options See Control options

Open source

This task is open source on GitHub. Feedback and contributions are welcome.

Q & A

I get a system error 53 when using this task. Why?

Typically this occurs when the specified path cannot be located. This may be due to a firewall blocking the necessary ports for file and printer sharing, or an invalid path specification. For more details, see Error 53 on Technet.

Do I need an agent?

You need at least one agent to run your build or release. Get an agent.

I can't select a default agent queue and I can't queue my build or release. How do I fix this?

See Agent pools and queues.

I use TFS on-premises and I don't see some of these features. Why not?

Some of these features are available only on VSTS and not yet available on-premises. Some features are available on-premises if you have upgraded to the latest version of TFS.

Help and support