?
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
?
281 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
Quick Start: DOCKER

Sometimes you just need a Quick Start on a topic in order to begin using it.. this is just what you need to know to get up and running with Docker!

 
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

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

777 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