Can't type to console window with Read-Host after PuTTY Plink command

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
ron.allison08
Posts: 4
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Tue Feb 16, 2016 12:04 pm

Can't type to console window with Read-Host after PuTTY Plink command

Post by ron.allison08 »

Hi all,
I have PuTTY Plink setup between my Windows machine and Linux compute cluster. I've developed a Powershell script that runs Plink commands, then prompts for user input. Unfortunately, after the Plink command is completed, I am no longer able to type anything to the console when the Read-Host prompts for input.

plink -i C:\users\<username>\private_key.ppk <username>@<computername> qstat -a
$returnToMenu = Read-Host -Prompt "Return to main menu? Y/n"
if ($returnToMenu -eq "Y") { mainMenu } else { return }

Please note, it works fine from the ps1 script, but not when the script is packaged as an executable. Any ideas on this?
Thanks!

jvierra
Posts: 14444
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Can't type to console window with Read-Host after PuTTY Plink command

Post by jvierra »

You cannot easily use pUtty with PowerShell as it divert5s the console. You can use maodules designed to use putty-like access to Telnet sessions.

Find-Module *putty*

User avatar
ron.allison08
Posts: 4
Joined: Tue Feb 16, 2016 12:04 pm

Re: Can't type to console window with Read-Host after PuTTY Plink command

Post by ron.allison08 »

Hi jvierra, we've attempted this approach, but importing modules requires setting the ExecutionPolicy, which is not possible for us. Please advise.

Thanks!

jvierra
Posts: 14444
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: Can't type to console window with Read-Host after PuTTY Plink command

Post by jvierra »

I don't see how we can help you with internal policy issues. You will have to check with your IT Admin to solve this problem.

I also sounds like your firewall or proxy is restricting Telnet protocols.

Locked