从 Team Build 运行 winrs 命令挂起
我的 TFS 构建工作流程中有一个步骤,尝试使用 winrs 在远程计算机上调用命令。我使用调用进程任务并给它 powershell 作为命令,然后传入一个脚本,其中包含类似
winrs -r:remote.server.com ipconfig
命令运行得很好,我可以在构建日志中看到输出,但是整个事情似乎在那时停止了。我可以登录远程框并确认没有 ipconfig 正在运行,因此该过程已完成,但就像 winrs 没有返回一样。我是否缺少一些技巧,也许是一面
-justBloodyWork
旗帜?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在这里找到答案: https://serverfault.com/questions/135070/why-does-my-powershell-script-hang-when- Called-in-psexec-via-a-batch-cmd-file
这是POSH 的一个常见问题。问题是 stdin 挂起。试试这个: winrs -r:remote.server.com ipconfig <零点
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 构建服务器遇到了同样的问题。 < NUL 适用于 bat 文件,但 < powershell 中已损坏。要在 powershell 中提供标准输入,请通过管道输入 $null:
<代码>
$空| winrs -r:remote.server.com ipconfig
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
尝试 -nop 选项。用户的配置文件始终会加载到远程系统上,这可能会导致问题。
Try -nop option. A user's profile always gets loaded on the remote system and this may be causing issues.