![](/img/trans.png)
[英]Powershell Invoke-SSHCommand: Exception calling “EndExecute” with “1” argument(s)
[英]In Powershell when running 'Invoke-SSHCommand' it throws exception as parameter can't be found as 'SSHSession'
我試過如下
$session = New-SSHSession -ComputerName $IPAddress -Credential $creds -AcceptKey
$result = Invoke-SSHCommand -SSHSession $session -Command "hostname"
例外如下
Invoke-SshCommand : A parameter cannot be found that matches parameter name 'SSHSession'.
+ $result = Invoke-SSHCommand -SSHSession $session -Command $updatepack ...
+ CategoryInfo : InvalidArgument: (:) [Invoke-SshCommand], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Invoke-SshCommand
我檢查了命令的文檔,如下所示
句法
Invoke-SshCommand [[-ComputerName] <String[]>] [-Command] <String> [-Quiet] [-InvokeOnAll] [<CommonParameters>]
Invoke-SshCommand [[-ComputerName] <String[]>] [-ScriptBlock] <ScriptBlock> [-Quiet] [-InvokeOnAll] [<CommonParameters>]
我看過參數名稱為SSHSession 的示例,不確定我導入的模塊是否版本錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.