1

我正在尝试通过 Powershell 在远程转码服务器上调用 ffmpeg:

$session = new-pssession -computername transcodingserver
Invoke-Command -session $session -scriptblock { powershell ffmpeg }

ffmpeg正确安装在远程服务器上,可以在那里运行,但是远程调用会报错:

ffmpeg : The term 'ffmpeg' is not recognized as the name of a cmdlet, function, script file, or operable program.
    + CategoryInfo          : NotSpecified: (ffmpeg : The te...rable program. :String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
    + PSComputerName        : transcodingserver

Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ ffmpeg
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (ffmpeg:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
NotSpecified: (:) [], RemoteException

在我看来,如果我运行的机器Invoke-Command试图运行 ffmpeg,它没有安装在那里。您需要做什么才能在远程服务器上运行 ffmpeg?

4

2 回答 2

2

你不需要powershell里面-scriptblock {..},因为Invoke-Command它本身就是一个 powershell 会话(尽管是一个临时的)。找到ffmpeg可执行文件的完整路径并运行以下命令

$session = new-pssession -computername transcodingserver
Invoke-Command -session $session -scriptblock { & "C:\Program Files\ffmpeg\bin\ffmpeg.exe"}

或者您可以直接执行命令,无需new-pssession

Invoke-Command -ComputerName transcodingserver -scriptblock { 
    & "C:\Program Files\ffmpeg\bin\ffmpeg.exe"}
于 2014-06-06T14:26:38.027 回答
0

有一个类似的问题解决了它

$media = Invoke-Command -ComputerName backupsvr -ScriptBlock { import-module "\program files\symantec\backup exec\modules\bemcli\bemcli"; Get-BEMedia}
于 2016-12-07T01:37:34.880 回答