darkoperator / darkoperator/Posh-SSH

New-SSHRemotePortForward not portforwarding

Open
#348 3 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

I saw a old issue which has not been responded to so have created a new one, when calling New-SSHRemotePortForward it throws a error

New-SSHRemotePortForward -LocalAdress 192.168.4.8 -LocalPort 1337 -RemoteAddress 192.168.5.6 -RemotePort 3389 -Index 0

Throws error

Write-Verbose : Cannot bind argument to parameter 'Message' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\2.2\Posh-SSH.psm1:2704 char:31
+                 Write-Verbose $session.index
+                               ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Write-Verbose], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.WriteVerboseCommand
`New-SSHRemotePortForward -LocalAdress 192.168.4.8 -LocalPort 1337 -RemoteAddress 192.168.5.6 -RemotePort 3389 -sshSession $CurrentSession

Throws error

Exception calling "Start" with "0" argument(s): "Port forwarding for '192.168.5.6' port '3389' failed to start."
At C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\2.2\Posh-SSH.psm1:2724 char:17
+                 $SSHFWP.start()
+                 ~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SshException

Note: I can portforward in a batch script and in git bash, issue is just when using this

Powershell version: 5.1.18362.752
Posh-ssh version: 2.2 from PSGallery
OS: Windows 10

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

Reproduce the reported commands in Posh-SSH.psm1 around lines 2704 and 2724 using PowerShell 5.1, Posh-SSH 2.2, and the supplied Windows setup. Inspect the verbose-message failure and the SSHFWP.Start() path, then verify that New-SSHRemotePortForward starts successfully without either error.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.