I have an InvokeProcess activity in my build template. I've put PsExec.exe into %windir%\system32\ folder on build machine and specified FileName in the InvokeProcess activity as "PsExec.exe" and some parameters in Arguments. But when build runs it gives an error "File Not Found: PsExec". I also tried FileNames like "%windir%\system32\PsExec.exe" and "%windir%\system32\PsExec.exe". When I try type "psexec" on Run from build machine everything works perfect.
One more thing. Should I put PsExec on machine where the build controller is running or where the build agent is running?
If you call InvokeProcess within an AgentScope activity then you will need to put the file on the build agent machine. Otherwise, it needs to be on the build controller machine.
As you might have guessed, we invoke your process using the Process class of .NET Framework. Your file name is set to the FileName property of the ProcessStartInfo. Whatever criteria required by this property is required by InvokeProcess.
One last thing, have you tried using the literal path C:\Windows\System32\PsExec.exe, just to rule out any weird thing that could prevent the Process object to pick up the path?