I\'m trying to get result from a command through VB.NET, it is returning empty string as shown in the below code:
Dim connInfo As New Renci.SshNet.PasswordCo
If the opmnctl fails for some reason, it might have produced a message on the error output.
So check also cmd.Error and cmd.ExitStatus.
Note that the .RunCommand method uses a non-interactive terminal, what may cause problems with some commands.
Particularly a different environment may be set, when the non-interactive terminal is used as a different set of startup scripts is executed and/or different branches in the scripts are taken (based on a value of a TERM environment variable).
In your case, it seems that the opmnctl is not included in PATH on non-interactive terminals.
You should get the same issue when you force the non-interactive terminal in your SSH client.
For example:
With OpenSSH command-line ssh client, use -T switch (Disable pseudo-tty allocation).
ssh -T user@host opmnctl status -l
The same with PLink (from PuTTY package)
plink.exe -T user@host opmnctl status -l
(The -T should be implicit when command is specified on command-line anyway)
Solution are:
opmnctl to PATH even on non-interactive terminals (preferred)opmnctl in your command.SendPseudoTerminalRequest request in .RunCommand implementation (I didn't test this).