【发布时间】:2015-08-07 07:03:52
【问题描述】:
我想编写一个 Powershell 脚本,通过其路径调用远程计算机上的可执行文件,然后等待它完成运行。这是我到目前为止所得到的:
$executable = "C:\Temp\example.exe"
$session = New-PSSession -ComputerName VIRTUALMACHINE
$job = Invoke-Command -Session $session -ScriptBlock {$executable} -AsJob
Wait-Job -Job $job
远程机器不是运行 C:\Temp\example.exe,而是运行字符串 $executable - 不完全是我想要的!
我该如何解决这个问题?
【问题讨论】:
标签: powershell-3.0 powershell-remoting invoke-command