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 9167603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:25:53+00:00 2026-06-17T15:25:53+00:00

I need help with executing commands on an Unix server using a Visual Basic

  • 0

I need help with executing commands on an Unix server using a Visual Basic application. I am using Visual Basic Express 2010.

P.S. I can connect to the server using systems.net.sockets but cannot send commands to execute.

I am open to trying any different approach, I just need to know how I can do this.

  • 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-06-17T15:25:54+00:00Added an answer on June 17, 2026 at 3:25 pm

    I can think of two ways to accomplish this:

    1. Have a program like Putty installed on the system and make an SSH call to the server (outside of the app) using Putty and sending your commands this way. This will require some elevated privileges on your app since it’s going to have to have access to the system directly. In my opinion, this is the “ugly” way to do this.

    2. Find a VB SSH library. I have found this one but there has to be more. This will allow you to create an SSH connection to the Unix box and pass over the commands you want to run. This would be the “best”‘ way.

    EDIT:

    It doesn’t really matter that it is CSHARP. You can download Visual C# 2010 Express and open Renci.SshNet and build it. Once it’s built you’ll get a dll that you can then add as a reference to your VB project. A little bit of a pain, but a small price to pay for using the Express editions. 🙂

    Here’s a screenshot of the ssh library open in Visual C# 2010 Express with the build run. You can see ‘build succeeded’ at the bottom left:
    screenshot of build

    Once you have it as a reference then you can use the library to make an ssh connection to the server and run your command. Here is some sample code. I created a VB web application, added the dll as a reference and added a click event to a button that spit the results into a label control:

    Protected Sub btnSSHTest_Click(sender As Object, e As EventArgs) Handles btnSSHTest.Click
    
        'Create the objects needed to make the connection'
        Dim connInfo As New Renci.SshNet.PasswordConnectionInfo("hostname", "username", "password")
        Dim sshClient As New Renci.SshNet.SshClient(connInfo)
    
        'Need to hold the command'
        Dim cmd As Renci.SshNet.SshCommand
    
    
        Using sshClient
            'connect to the server'
            sshClient.Connect()
    
            'Run the command and put the results into the cmd object. In this case'
            'I am just running a directory list'
            cmd = sshClient.RunCommand("ls -lthr")
    
            'my web page had a label control on it. I placed the results of the cmd into'
            'the label'
            lblResult.Text = cmd.Result
    
            'Close the connection.'
            sshClient.Disconnect()
        End Using
    
    End Sub
    

    EDIT:

    Just to make sure it worked in a non-web application, I did the example in a Windows Form app I created using Vb 2010 express. I added a button and a label to the form and added the code above to the button click event. Then I added a reference to the DLL (library) I created from C# 2010 Express.

    This is a screenshot of adding the reference:
    how to add a reference

    Here is a screenshot of the project properties showing the reference has been added:
    screenhot showing the reference in the project

    Next, I ran the project and clicked the button. THe connection to unix box was made and the results of the command (in this case ‘ls -lthr’) were placed in the label. I logged in as root (not recommended) and ran the command from the /root/ directory. That is why there is not much there.
    application running

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

Sidebar

Related Questions

Im currently using a java application to run commands on a unix box by
I need help coming up with a way of executing the following sequence using
Need help writing a script downloads data from google insight using c# this is
I need to develop a client server system where I can have multiple clients
Using Entity Framework 5 , Visual Studio 2010 with the Entity Framework Power Tools
I can run the following commands in the console for my Rails application and
I am working with Delphi 2010 and the ShellAPI. I need a little help
I need some help in terms of profiling existing code in terms of execution
Need help, function getFamily() { FB.api('/me/family', function(response) { alert(JSON.stringify(response)); }); } With the above
Need help with a query that I wrote: I have three tables Company id

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.