To install the TeamCity agent on a remote computer in the TeamCity UI on the Agents page select the Agent Push tab.
Make sure the remote computer is accessible by PSEXEC. See Configure the target server for PSEXEC
If the remote server is in the domain, make sure you prefix your username with the domain name to avoid the error message:
The handle is invalid.
Couldn’t access SERVER_NAME:… was executed with error message(s): Execution error. Return code=6