Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Executing Powershell command through freeSSHd is blocking SSH.NET

$
0
0
The SSH.NET library is locking up when I run a Powershell script through freeSSHd. Executing VBScripts through cscript works without issue. I have included example C# code for both (see below). In both cases, the scripts simply involves writing a string to STDOUT.

Stepping into the code, the code is blocking on Session.SocketRead after the SSH_MSG_CHANNEL_DATA message occurs. More specifically, executing the VBScript command generates a SSH_MSG_CHANNEL_REQUEST message, but executing the Powershell command does not.

I have tested the command line in a Command Prompt as well as executing it through an SSH client (putty) without issue. Can anyone give me a workaround or confirm whether this is a bug in the SSH.NET or freeSSHd?

// This works without issue
var client = new Renci.SshNet.SshClient("127.0.0.1", "username", "password");
client.Connect();
var command = client.CreateCommand("cscript.exe /nologo C:\test.vbs");
command.Execute();

// This blocks
var client = new Renci.SshNet.SshClient("127.0.0.1", "username", "password");
client.Connect();
var command = client.CreateCommand("PowerShell.exe C:\test.ps1");
command.Execute();

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>