4

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?

stimms
  • 42,945
  • 30
  • 96
  • 149

3 Answers3

2

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

Community
  • 1
  • 1
Yauheni Sivukha
  • 2,586
  • 20
  • 22
1

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

Matt Hopkins
  • 211
  • 2
  • 2
0

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

ravikanth
  • 24,922
  • 4
  • 60
  • 60