Remote PSSession telnet not working

0

When I start a remote PS session and I execute the command telnet 1.2.3.4 nothing happens a new line just starts. If I RDP to server and start PS, execute the same command the telnet session opens just fine. How can I make this work in a remote PS Session?

See screenshot for more info.

screenshot

WagoL

Posted 2017-01-09T08:50:54.210

Reputation: 1

What do you mean by "new line just starts"? How did you establish the PS session? What did you do to make the telnet command to be run on the session rather than local? – Seth – 2017-01-10T09:46:55.027

Due to firewall rules i can't telnet to the device from my machine. Also added a screenshot – WagoL – 2017-01-10T09:55:47.003

The computer name is placed in front of the telnet line after you use Enter-PSSession, you forgot to redact it in that space. So it does work if you use the same machine? You could try to check $? for an error code that would indicate that telnet wasn't run successfully. – Seth – 2017-01-10T09:59:48.630

TY Redacted it now :). When I first run the telnet and then $? it says true. I have no idea what that means. Better should've posted I'm new to PS. – WagoL – 2017-01-10T10:03:29.427

It would tell you whenever the last command ran successfully. See this and this. So you do get a connection if you directly RDP into the server using the same user?

– Seth – 2017-01-10T10:14:08.677

This is the same user but in RDP session screenshot. What I think is wrong after reading up, is that telnet is not using the PS stdin/stdout. But I could be wrong.

– WagoL – 2017-01-10T10:29:13.680

Indeed it appears that telnet is "broken" in this case. You could look into a solution like this if you want to use PS for it. Otherwise consider using an alternative client like putty which supports parameters.

– Seth – 2017-01-10T10:55:12.403

Answers

1

It's because telnet is an interactive program. Powershell doesn't handle interactive programs like telnet, because I had the same issue using git when it's supposed to prompt you for credentials. This person here had the same issue as us basically. I haven't tried it myself, but maybe telnet cmdlets in this powershell module is worth a shot.

arjabbar

Posted 2017-01-09T08:50:54.210

Reputation: 113