With SSH.NET it's rather easy to perform simple commands at the shell that the remote SSH server runs for the client.
For instance, I can just make a call like this (after the connection is esablished):
SshCommand cmd = myClient.CreateCommand("ls");
string response = cmd.Execute();
But what if the command raises an interactive sub shell? For example, say I SSH into a Windows computer and there may be CMD or PowerShell running for me, but I always want PowerShell. A simple approach would be to execute the command "PowerShell" in any case first, which starts a sub-shell for me. That would take me from CMD into PowerShell.
BUT the simple cmd.Execute() doesn't work here, does it? It looks like the call never returns (or maybe only by timeout) because the program I execute (PowerShell) doesn't either, as it waits for input. Ideally, I'd like to work with SshCommand objects against the sub-shell as well, which would provide me with things like the ExitStatus of commands that I run.
Is that possible? What's the best approach for this?