

StartInfo.Arguments = host + " " + command Ĭall it like PlinkWrapper plink = new (var str in plink.RunCommand("pwd"))Īnd the output will be like > /home/albin ProcessStartInfo startInfo = new ProcessStartInfo("plink.exe")
/ Runs a command and returns the output lines in a List
/ The host, on format PlinkWrapper(string host)

/ Assumes the key for the user is already loaded in PageAnt. The trick to not show a window is to set ProcessStartInfo.CreateNoWindow = true.Īdd some error handling to this and you're done. It is quite easy to call plink without the shell popping up. Support forum uses engine very similar to this site and runs on ĭisclaimer: I am involved in development of Rebex SSH The Rebex SSH Shell is 'just' another layer on top of it (most notable addition is a terminal emulator). The Rebex SFTP (which uses this SSH lib as a transport layer) is used by Microsoft in several products including Expression Web and Visual Studio 2010. You might be already using Rebex SSH core library without knowing about it. String systemName = client.RunCommand("uname -a") Ĭonsole.WriteLine("OS info: ", systemName) įor advanced scenarios (such as interactive commands) see SSH Shell Tutorial. run the 'uname' command to retrieve OS info Following code shows how to connect to a *nix box, run a command and read the response using our Rebex SSH Shell. There are several commercial SSH client libraries for C#. while the commercial library seems nice I prefer something free (as in cost and free in source if possible). If the command output is simple should I just run plink/putty(is it difficult to run a windows cmd shell for plink, and capture output(and is there a way to do it without the shell popping up)? (the info I'm retrieving isn't sensitive but if the ssh implementation might have unpatched security flaws(if they haven't been updated for years) I'm worried about someone stealing my credentials.Īre there any other decent c# ssh libraries. There doesn't seem to much decent advice about using ssh from c# out there, sharpSSH and Granados seem to have not been updated for years, are they decent? should I be possible worried about security issues? There is a nice c# api to get this information from windows, on *nix its simple enough to run a command and parse the output to my needs. (I need information from both a windows box and a linux box, plus I think that making a program/script that runs without gui and accesses windows from a linux box without user intervention would be more difficult, if this is not true please tell me, I would love to do get this running on *nix with only the part that access windows info running on windows). Note that this has to be on a windows box as I am using c# to access information about windows
