2
votes

Running TFS 2010

I am trying to do a proof of concept, having batch files run as part of the build process. I have an 'invokeProcess' in my build seqeunce which runs a batch file. When I run the build, it 'partially succeeds' and then shows an 'access denied' error on the batch file.

Thoughts? Honestly I'm not even sure how to diagnose what user it is trying to run under.

2
What is the batch file doing? - Darin Dimitrov
Just a proof of concept - creating a dummy text file with some random text - dah97765
How about changing the batch file to do nothing at all? - John Saunders
@JohnSaunders I thought you were crazy at first... and then I realized what it was doing. Using the suggestion from Jeremy in one of the answers below, I filtered everything out of procmon except for ACCESS DENIED... and I realized that it wasnt the batch file that it didnt have access to, but the c/system32/test1.txt that I was trying to create. I thought it would have created it in the local folder, but then I realized that it was ... local to the location of cmd.exe :) Once I changed the .bat file to just EXIT, it worked fine. THANK YOU. - dah97765

2 Answers

2
votes

Is your build server different than your TFS server? In our environment, our build server runs all the windows services that execute the builds. Those builds are executed under the context of the user id that the build service is configured to start with.

To execute a batch file, you not only need to give permissions to the batch file itself, but you also need to grant rights to the cmd.exe file (since this will execute a new command line process) as well as any executables your batch file may call.

Try running procmon (http://technet.microsoft.com/en-us/sysinternals/bb896645) and execute your build again - it will show you exactly what files the system is denying access to.

1
votes

Have you verified that the service account that is the identity for the build service has access to the batch location? You can find the service account in the TFS Administration Console (available on your TFS Server)