Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

vb.net can I run program from a v by vb.net installed on a client by using command line?

Posted on 2010-08-12
6
Medium Priority
?
287 Views
Last Modified: 2013-11-26
I want to run .exe , vbscript, shel programs from my folder on my vb.net app...and I need to run a vbscript that will have access to the clinet command line...is this a problem?  I dont believe so...but before I start this big project i need to be sure...thanks
0
Comment
Question by:GlobaLevel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 3

Expert Comment

by:bkokx
ID: 33427059
You can run anything from a VB.Net app when you have sufficient credentials on the system. Could you be a bit more precise. The VB.NET code below writes a vbscript and then executes it from the same location.
Module Module1

    Sub Main()

        Dim sw As System.IO.StreamWriter
        sw = System.IO.File.CreateText(".\myscript.vbs")
        sw.WriteLine("Dim Shell")
        sw.WriteLine("Set Shell = WScript.CreateObject(""WScript.Shell"")")
        sw.WriteLine("Shell.Run(""c:\windows\system32\calc.exe"")")
        sw.Close()
        Shell("cscript .\myscript.vbs")
    End Sub

End Module

Open in new window

0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 33429785
1) the vb.net app sits locally will be launched from a remote app via .net.sockets
2) once the vb.net launches it will run to a remote db via system.data sql connection and pull the latest data stored in a string variable
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 33429983
1) the vb.net app sits locally will be launched from a remote app via .net.sockets
2) once the vb.net launches it will run to a remote db via system.data sql connection and pull the latest data stored in a string variable over a secure connection (using a .pfx in vb.net?)?
3) comes back to the vb.net app and launch a vbscript that is stored in a folder inside the vb.net app
4) the string from the remote db will be passed into the vbscript
5) the vbscript will run this string against a .exe (the .exe is stored in a folder in the vb.net-AND THE FOLDER MUST BE SECURED_SO NO USER ACCESS ONLY ADMIN) via a command line
6) the the vbscript then will take the values from the command line and store in a .txt file in a log folder from inseide
the vb.net
7) the vb.nett will send this same data back to the remote db...


if you have code for the above..wow that would be great..i know its general...but the specifics can be added later..


0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
LVL 3

Expert Comment

by:bkokx
ID: 33433315
Hi GlobaLevel,

Sounds like a very complex way of solving things.... Why have all these steps instead of having a single application listening on a port that accepts commands from a remote system and executes it?
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 33435158
bkokx,

Great idea..I thought that was what I was doing..if you have any samples..great!
0
 
LVL 3

Accepted Solution

by:
bkokx earned 2000 total points
ID: 33439453
Hi GLobaLevel,

When I look at your original requirements I have the following design remarks:
1. Your client application should be running already on the client either as a normal application or (prefered) as a windows service. This of course requires pre-installation. Now of course the question is how will the application be triggered, does it regularly poll the server or does the server go on the network to search and connect to the clients?
2. There are many ways to get the string mainly depending on how you implement the application; one would be that the server just returns the string at once so you do not need a database connection or you could determine that the sql is the server application so you do not need a server side application. In the later case ensure you also have a unique number so the client can track if the command has already been executed.
3/4/5/6. I would run all of this from inside the service, so no additional vbscripts unless of course there are addition design constraints that I do not known. Running it as a service also simplifies protection.
7. Again depending on your design choices you could send a response string to the server application or work directly with the database.

Of course this is a more complex app to write but for many of its elements you will find good examples on the internet, some that will get you on your way are:

http://www.codeguru.com/vb/gen/vb_system/services/article.php/c4825
http://www.codeguru.com/columns/dotnet/article.php/c6027
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question