Open dav101 opened 4 years ago
No problem, seems there is an issue with the underlying library. I may remove this cmdlet since dev on the library is so low which has impacted module releases as a consequence.
On Oct 1, 2020, at 12:47 PM, dav101 notifications@github.com wrote:
I saw a old issue https://github.com/darkoperator/Posh-SSH/issues/192 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
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/darkoperator/Posh-SSH/issues/348, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD7IHX7Z7AER3QCGHIY2ZTSISXDLANCNFSM4SAVPT5Q.
I was just playing with this cmdlet and came across this error as well. Also the typo in the -LocalAddress option only having one "d" (-LocalAdress).
Write-Verbose: C:\Users\MMINOR\Documents\PowerShell\Modules\posh-ssh\3.0.0\Posh-SSH.psm1:2710
Anyway, I can see this is low-priority, but I feel better adding my 2 cents.
Hi, you can easily fix it by changing the index to SessionId:
foreach($session in $Global:SshSessions)
{
Write-Verbose $session.SessionId
if ($session.SessionId -eq $Index)
{
# Add the forward port object to the session
Write-Verbose "Adding Forward Port Configuration to session $Index"
$session.session.AddForwardedPort($SSHFWP)
Write-Verbose "Starting the Port Forward."
$SSHFWP.start()
Write-Verbose "Forwarding has been started."
}
}
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
Throws error
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