BuildAgent access to xcopy or attrib when run as a Windows service

We are running TeamCity. I've installed a BuildAgent to a  Windows box where it is run as a service. Instead of running it under  Local System account, I've decided to run it as a dedicated user. This  machine was used to build our solutions in the past and all necessary  tools are already installed and accesible by this user.

Most of the building and testing works fine. But I have some pre- and  a postbuild steps doing administrative work. Those steps use external  commands like attrib and xcopy (as usual, located in System32). These  cannot be executed by the BuildAgent when started with the dedicated  user. If I add the complete path to System32 to these commands, they  also work well. So obviously, it seems to be an environment problem.

When started with the Local System account, these steps are executed  as expected. (There are other reasons not to use the Local System  account, so that's no solution, unfortunately.)

The fallback, running the BuildAgent from the console, works fine as  well. But since it is also possible to run the BuildAgent as a service  when using the Local System account, I'm looking for a way to modify the  dedicated user (rights or environment) to enable it to run the  BuildAgent as a service.

What am I missing?

Comment actions Permalink


It sounds simillar to an issue described in TW-2266.
Please run set command within your build script and check how PATH environment variable is populated for the agent process.


Please sign in to leave a comment.