stimms
stimms

Reputation: 44094

Running winrs command from Team Build Hangs

I have a step in my TFS build workflow which attempts to invoke a command on a remote machine using winrs. I use an invoke process task and give it powershell as the command then pass in a script which contains something like

winrs -r:remote.server.com ipconfig

The command runs just fine and I can see the output in the build logs, however the whole thing seems to stall at that point. I can log into the remote box and confirm that no ipconfig is running so that process has finished but it is like winrs isn't returning. Is there some trick I'm missing perhaps a

-justBloodyWork

flag?

Upvotes: 4

Views: 1166

Answers (3)

Matt Hopkins
Matt Hopkins

Reputation: 211

Bamboo build server runs into the same issue. < NUL works for bat files, but < is broke in powershell. To supply standard input in powershell, pipe in $null: $null | winrs -r:remote.server.com ipconfig

Upvotes: 1

Yauheni Sivukha
Yauheni Sivukha

Reputation: 2596

Found the answer here: https://serverfault.com/questions/135070/why-does-my-powershell-script-hang-when-called-in-psexec-via-a-batch-cmd-file

This is a common issue with POSH. The problem is that stdin hangs. Try this: winrs -r:remote.server.com ipconfig < NUL

Upvotes: 2

ravikanth
ravikanth

Reputation: 25810

Try -nop option. A user's profile always gets loaded on the remote system and this may be causing issues.

Upvotes: 0

Related Questions