0

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?

4

1 回答 1

1

我在远程执行安装程序时遇到了类似的问题。作为一种解决方法,我现在首先通过 powershell 创建一个 cmd 批处理文件,然后运行这个批处理文件。像这样的东西:

"c:\external_command.exe argument1" > c:\run.cmd
&"c:\Run.cmd" |Out-Null 
于 2011-12-09T07:40:16.980 回答