Powershell远程会话外部命令执行
我一直在使用 powershell 远程处理,但遇到了一个无法解决的问题。我有一个创建远程会话的脚本,并在设置一些变量后执行以下操作:
Invoke-Command -Session $remote_session -ScriptBlock $block -ArgumentList $args
在块内,一切正常,除非涉及特定行,此时脚本会挂起。相关行是:
& '.\external_command.exe' $argument_list
当我登录到托管远程 powershell 会话的计算机时,我可以在进程列表中看到 external_command.exe
,但它没有执行任何操作。有人对如何解决该问题有任何想法吗?
I've been playing around with powershell remoting and I've come across a problem that I am unable to resolve. I have a script that creates a remote session and after setting up some variables does the following:
Invoke-Command -Session $remote_session -ScriptBlock $block -ArgumentList $args
Within the block everything works fine except when it comes to a specific line, at which point the script hangs. The pertinent line is:
& '.\external_command.exe' $argument_list
When I log into the computer that is hosting the remote powershell session I can see external_command.exe
in the process list but it's not doing anything. Does anyone have any ideas on how to resolve the issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在远程执行安装程序时遇到了类似的问题。作为解决方法,我现在首先通过 powershell 创建一个 cmd 批处理文件,然后运行该批处理文件。像这样的事情:
I had similar problems with remote execution of installers. As a workaround I now first create a cmd batch file through powershell and then run this batch file. Something like this: