Using powershell scripts with teamcity

Anybody got powershell scripts working with teamcity?

If I specify my command executable as run.ps1 with any/no code contained inside, my build will never finish because the powershell process doesn't end. So I have to manually stop the build process. Fair enough, that makes sense to me, so I tried to invoke powershell through some special syntax.

If I specify my command executable as run.cmd for teamcity to call initially. Then in that file, I invoke the powershell script

run.cmd
powershell.exe -command "& {  }"

After running that code, powershell should automatically exit I believe. But apparently it's not.

2 Questions

Anybody know exactly what's going on?
What are the workarounds? Or shall I declare powershellscripts dont work with teamcity for whatever reason.

Heres the link to the above code in case anyone wondering where I got it from:
http://blogs.technet.com/brianwren/archive/2008/02/20/running-powershell-scripts-from-a-management-pack.aspx

2 comments
Comment actions Permalink

Hi!

We have several reports on the issue, see details in our issue tracker at http://jetbrains.net/tracker/issue/TW-6021

It seemsto be some powershell issue with input streams reading/waiting. There are some workarounds in the issue and linked threads.
There is still no known solution that we can implement in TeamCity's scope to address the issue.

Yegor

0
Comment actions Permalink

Awesome. The workaround works!

0

Please sign in to leave a comment.