TeamCity error 'tscon.exe' is not recognized as an internal or external command

笑着哭i 提交于 2019-12-11 08:08:50

问题


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?


回答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/




回答2:


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):

  • Now the remote machine will login locally before completing the TC steps


来源:https://stackoverflow.com/questions/25122976/teamcity-error-tscon-exe-is-not-recognized-as-an-internal-or-external-command

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!