Powershell build step hangs

In TC 7.0.2, we have a script that runs perfectly on its own, but always hangs when run by TC.

When I run it directly from PS, it runs fine.

When TC runs it, TC executes the following:

C:\Windows\sysnative\cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe  -NonInteractive -File  E:\BuildAgent\work\518dfb011bf9a362\deploy\ourScript.ps1 2.0.2.46  .\inputs.xml -executionpolicy bypass &&  exit /b %ERRORLEVEL%

The script runs about 50% of the way before hanging. I added logging to the script itself, so I can see that it does indeed stop writing to the log at the same time that TC stops showing any new output from it.


However, if I run that same command directly, the script always runs perfectly to completion.  (Note that I reference cmd.exe directly.)

cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe  -NonInteractive -File  E:\BuildAgent\work\518dfb011bf9a362\deploy\ourScript.ps1 2.0.2.46  .\inputs.xml -executionpolicy bypass &&  exit /b %ERRORLEVEL%


The step is set up as a x64 Powershell step with "Execute PS1 script with -File argument" mode.

The agent runs on W2K8 under a service account (no support for RDP), whereas when I login, I'm logging in as my own account, if that makes a difference.

Any ideas?


Thanks

1 comment
Comment actions Permalink

Hi Jimmy

You can start TeamCity build agent interactively within your user session by agent.bat. Please check how it works in this case.

0

Please sign in to leave a comment.