Page 1 of 1

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

Posted: Tue Dec 10, 2019 12:17 pm
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!

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

Posted: Tue Dec 10, 2019 2:10 pm
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*

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

Posted: Tue Dec 10, 2019 2:13 pm
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!

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

Posted: Tue Dec 10, 2019 3:36 pm
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.