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?
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With