question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Georgy-Savcommented, Aug 23, 2022

I had the same problem with Posh-SSH version 3.0.1. For me the solution was to manually delete Renci.SshNet folder from C:\Windows\Microsoft.NET\assembly\GAC_64

0reactions
Georgy-Savcommented, Aug 25, 2022

@bbrown2008, I think this PS command could helped in your case: [System.AppDomain]::CurrentDomain.GetAssemblies() | ? { $_.Location -like '*GAC*Renci.SshNet*' } It shows locations of all Renci.SshNet dlls from all GAC locations after you import Posh-SSH module.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows PowerShell forum
new-netroute : Invalid parameter InterfaceAlias vEthernet (cbr0) ... Cannot convert the "Renci.SshNet.ShellStream" value of type "Renci.SshNet.ShellStream" ...
Read more >
Posh-SSH.psm1 2.1
SSH Shell Stream. [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, ValueFromPipeline=$true, Position=0)] [Renci.SshNet.ShellStream]
Read more >
Posh-SSH headaches : r/PowerShell
EDIT SOLVED: using the Renci.SshNet source I was able to skip over the posh-ssh piece and call the library directly achieving the goal....
Read more >
Cannot process argument transformation on parameter ...
Any time I've tried to pipe the values from my .csv file into the next command, it responds with "Cannot process argument transformation...
Read more >
packages - SSH.NET.2016.1.0 - lib - sl4 - Renci.SshNet.xml
Fills an array of bytes with a cryptographically strong random sequence of values. 17. </summary>.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found