Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1063543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:47:52+00:00 2026-05-16T18:47:52+00:00

Note that this has to be on a windows box as I am using

  • 0

Note that this has to be on a windows box as I am using c# to access information about windows

(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).

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.

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?

(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.

Are there any other decent c# ssh libraries. 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)?

P.S. while the commercial library seems nice I prefer something free (as in cost and free in source if possible).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:47:52+00:00Added an answer on May 16, 2026 at 6:47 pm

    It is quite easy to call plink without the shell popping up.

    The trick to not show a window is to set ProcessStartInfo.CreateNoWindow = true.
    Add some error handling to this and you’re done.

    — PlinkWrapper.cs —

    using System.Collections.Generic;
    using System.Diagnostics;
    
    namespace Stackoverflow_Test
    {
        public class PlinkWrapper
        {
            private string host { get; set; }
            /// <summary>
            /// Initializes the <see cref="PlinkWrapper"/>
            /// Assumes the key for the user is already loaded in PageAnt.
            /// </summary>
            /// <param name="host">The host, on format user@host</param>
            public PlinkWrapper(string host)
            {
                this.host = host;
            }
    
            /// <summary>
            /// Runs a command and returns the output lines in a List&lt;string&gt;.
            /// </summary>
            /// <param name="command">The command to execute</param>
            /// <returns></returns>
            public List<string> RunCommand(string command)
            {
                List<string> result = new List<string>();
    
                ProcessStartInfo startInfo = new ProcessStartInfo("plink.exe");
                startInfo.UseShellExecute = false;
                startInfo.RedirectStandardOutput = true;
                startInfo.CreateNoWindow = true;
                startInfo.Arguments = host + " " + command;
                using (Process p = new Process())
                {
                    p.StartInfo = startInfo;
                    p.Start();
                    while (p.StandardOutput.Peek() >= 0)
                    {
                        result.Add(p.StandardOutput.ReadLine());
                    }
                    p.WaitForExit();
                }
    
                return result;
            }
        }
    }
    

    — END PlinkWrapper.cs —

    Call it like

    PlinkWrapper plink = new PlinkWrapper("albin@mazarin");
    foreach (var str in plink.RunCommand("pwd"))
        Console.WriteLine("> " + str);
    

    and the output will be like

    > /home/albin
    

    The nice thing with plink is that it is well proven and integrates well with pageant.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone seen this type of IE display problem? Example http://xs133.xs.to/xs133/08465/ie_problem910.jpg.xs.jpg Note that it
Note that this function does not have a { and } body. Just a
Let's say I have a simple stored procedure that looks like this (note: this
Note: I found this Creating a Word Doc in C#.NET , but that is
The attached screenshot is from OS X/Firefox 3. Note that the center tab (an
Note that I am not asking which to choose (MVC or MVP), but rather
We're seeing the error message ORA-00936 Missing Expression for the following SQL: Note that
How do I load a Python module given its full path? Note that the
When I go to create my status bar overlay, I note that I can
Can someone explain me the reason of overflow in variable a? Note that b

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.