I'm trying to setup a build using TeamCity and Leiningen, but I don't think this is particularly pertinent to my question.

There are two TeamCity services, one for the build server and another for a build agent. Both services are running under "Local System". The server is running Windows Server 2008 DataCenter [version 6.0.6002].

I've copied files into the folder C:\Windows\System32\config\systemprofile and I seem to be able to access them as the system account. By 'seem', I'm referring to being able to do the following from Command Prompt:

psexec -s \\localhost cmd
foo bar

where foo bar is the command that the TeamCity build agent should be running. [It's extremely unlikely that there's a difference in what the build agent is specified to do and what I did; foo bar isn't much shorter than the actual one-line command.]

I restarted both TeamCity services but the same "... can not be found." error persisted. I restarted the server, as I suspected this might be similar to how services cannot access changes to environment variables until after the server has been restarted, but (alas) that did not seem to resolve the problem.

I now suspect this is an issue with TeamCity.

  • Is the service specifying the full/exact path to the file when it tried to run it? You might be able to run it while logged in because it's in your PATH environment variable, which probably doesn't exist for the account the servic0e logs in as. Jun 3, 2014 at 16:45
  • @techie007, the service is running foo bar and it's complaining about not being able to find a file with the exact full path of the file that exists. I'm able to run it while logged in as the same account as the one under which the service is running. psexec -s \\localhost cmd runs Command Prompt as the Local System account. Jun 3, 2014 at 16:49
  • I have read your comment 3 times. I still can't figure it out. I can promise you, if your getting a "can not be found" the file actually can't be found.
    – Ramhound
    Jun 3, 2014 at 17:26
  • @Ramhound, anything in particular about my comment (or question) that's unclear? I believe you about the file not being found; I updated my question to state that I suspect the problem is with the TeamCity program. I think that the command is being executed in an altered context, and the files are inaccessible in it. Jun 3, 2014 at 18:17
  • I would first try and not use shorthand. This means don't use \\localhost use the entire and full directory.
    – Ramhound
    Jun 3, 2014 at 19:19


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.