1

I'm using tscon.exe to unlock a remote machine locally before I can run automation tests. When I run my command via RDC it works as expected and unlocks the remote machine locally:

C:>tscon.exe %sessionname% /dest:console

But I need this to run as my first TeamCity build step. Doing so either as a direct TeamCity Custom Script or starting a .bat file, both return the error:

[16:50:22][Step 1/11] in directory: C:\BuildAgent\work\e4249c2d6a4e9e8d [16:50:22][Step 1/11] 'tscon.exe' is not recognized as an internal or external command,

Why is tscon.exe not recognised when used via TeamCity?

Benny Meade
  • 602
  • 10
  • 25

2 Answers2

1

I just had same issue and moving the exe out of System32 is not an option for me.So I have to dig deeper.

Turns out the problem is not Teamcity. It's windows.

"The windows filesystem redirection forces 32-bit application attempts to be installed into or accessed from %windir%\System32, been intercepted and get redirected or re-pointed to %windir%\SysWOW64 instead."

The solution is to use an alias name ( %windir%\Sysnative ) for that directory which windows will not redirected.

Try this :

 C:\Windows\Sysnative\tscon.exe %sessionname% /dest:console

For more detailed Reference : http://www.tipandtrick.net/how-to-suppress-and-bypass-system32-file-system-redirect-to-syswow64-folder-with-sysnative/

LeY
  • 659
  • 7
  • 21
0

Here is the solution:

  • Copy tscon.exe to any location other than %windir%\System32\
  • i.e. C:\TeamCity\tscon.exe
  • Add TC build step as below (ensure to include Working Dir):

enter image description here

  • Now the remote machine will login locally before completing the TC steps
Benny Meade
  • 602
  • 10
  • 25