If you want to run Coded-UI test on Lab Environment machine then you need to copy the binaries files to that machine, you can create script that do that but also you can create some customization for the build process to do that as the following.
In our scenario we have 2 machines, the first one (Visual Studio 2013 ALM RTM) it’s a TFS machine with Test Control and the second one (Agent) it’s a machine with Test Agent.
The first step on the Agent machine, share the folder that will hold the binaries.
From the Tool Box type get and drag and drop GetBuildDetail Activity, you need to put it between Update Build Number and Run on Agent.
Click on variables and declare a new variable of type IBuildDetail to hold the return value from GetBuildDetail Activity, in my case I called that variable RadwanBuildDetail.
From the Tool Box drag and drop CopyDirectory, you must put it in Run on Agent, from the properties, select the source which is our variable and in the Destination , type the UN path for our shared folder, of course in real scenario you will not hard coded that Destination and you will make that as argument; so you can enter that by just edit the Build Definition.
If you run this build the output of the drop folder will be copied to the Lab Management machine.