Deploy: Windows Machine File Copy

Last Update: 3/15/2017

Team Services | TFS 2017 | TFS 2015 | Previous versions (XAML builds)

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.


Argument Description
Copy files from options

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.

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:,,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 and built-in system accounts such as NT Authority\System are not supported.

The password for the administrative account specified above.

  • Consider using a secret variable global to the build or release definition 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 options
Clean Target

Set this option to delete all the files in the destination folder before copying the new files to it.

Copy Files in Parallel

Set this option to copy files to all the target machines in parallel, which can speed up the copying process.

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

Clear this check box if you want to disable a step. This is a handy option if a step is not working correctly or if you need to focus on other parts of the process.

Tip: You can also right-click the build step to toggle this setting.

Continue on error

If an error occurs in this step, and this check box is:

  • Cleared: The build fails and no subsequent steps are run.
  • Selected: The build will be partially successful at best, and the next step is run.
Always run Select this check box if you want the step to run even if the build is failing.
Timeout The timeout for this task in minutes. The default is zero (infinite timeout).


Do I need a build agent?

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

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

See queues.

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

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