Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 363
stimms Avatar asked Oct 31 '25 07:10

stimms


2 Answers

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

like image 169
Yauheni Sivukha Avatar answered Nov 03 '25 18:11

Yauheni Sivukha


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

like image 23
Matt Hopkins Avatar answered Nov 03 '25 19:11

Matt Hopkins