darkoperator / darkoperator/Posh-SSH

Cannot process argument transformation on parameter 'ShellStream'. Cannot convert the "Renci.SshNet.ShellStream" value of type "Renci.SshNet.ShellStream" to type "Renci.SshNet.ShellStream".

Open
#439 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1.1k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

While triggering Invoke-SSHStreamShellCommand, I am getting Cannot convert the "Renci.SshNet.ShellStream" value of type "Renci.SshNet.ShellStream" to type "Renci.SshNet.ShellStream". Error on azure devops pipeline.

Script block

function remoteConnectEngine($secUsername, $VmPassword, $remoteMachine) {
    $password = ConvertTo-SecureString $VmPassword -AsPlainText -Force;
    $pscredential = New-Object -TypeName System.Management.Automation.PSCredential("$secUsername", $password);
    removeExistingSession;
    Write-Host "##[section] Get the current EPOCH time !!!"
    Start-Sleep -Seconds 5; 
    $triggerJMeterTest = "bash ./startJMeterTest.sh";
    foreach ($rm in $remoteMachine) {
         $currentSessionID = New-SSHSession -ComputerName $rm -Credential $pscredential -Forcs; 
         $SSHStream = New-SSHShellStream -Index $currentSessionID.SessionId;
         Invoke-SSHStreamShellCommand -ShellStream $SSHStream -Command $triggerJMeterTest;
    }
    Start-Sleep -Seconds 5;
    removeExistingSession

}
function removeExistingSession {

    $remove = Get-SSHSession
    if ($null -eq $remove -or $remove -eq 0) {
        Write-Host "##[section] No active past session present !!!"
    }
    else {
        foreach ($existingSessionID in $remove.SessionId){
            $removeTheSession = Remove-SSHSession -SessionId $existingSessionID
                if($removeTheSession) {
                    continue;
                    }
                else { 
                    Write-Host "##[error] There is a problem with terminating the active session with ID" $removeTheSession
                }
        }
        Write-Host "##[section] All active session terminated successfully!!!"
    }

    }

function startJMeterServer {
    $loadAgentMachine = '<remote_machine_Name>'
    $LoadAgentUserName       = "<User_Name>";
    $LoadAgentVMPassword     = "<Password>";
    remoteConnectEngine $LoadAgentUserName $LoadAgentVMPassword $vm_Machine

}

Error Details:

Invoke-SSHStreamShellCommand : Cannot process argument transformation on parameter 'ShellStream'. Cannot convert the 
"Renci.SshNet.ShellStream" value of type "Renci.SshNet.ShellStream" to type "Renci.SshNet.ShellStream".
At E:\agent\_work\40\s\PerformanceEvaluation\testJMeter.ps1:81 char:73
+ ... ommand = Invoke-SSHStreamShellCommand -ShellStream $SSHStream -Comman ...
+                                                        ~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Invoke-SSHStreamShellCommand], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Invoke-SSHStreamShellCommand

image

How to resolve this issue.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the New-SSHShellStream and Invoke-SSHStreamShellCommand calls in the supplied script, then reproduce the parameter transformation failure in the Azure DevOps pipeline. Compare the loaded Renci.SshNet.ShellStream types and assemblies at both entry points; done means the created stream is accepted by Invoke-SSHStreamShellCommand and the remote command runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.