Running an application remotely in .NET

Hey folks,
We have a bunch of scripts that we have written to do some automation of our processes and these are written in C sharp (console apps). Unfortunately all these were written to be executed on a particular machine.

Now our business case has changed and we want to trigger the execution of these exes from a client machine.
Can someone share the code of how this can be done in .Net? any pointers, references, dlls that I can reference, anything goes.
Thanks,

Kunal
kunal_hopra28Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kunal_hopra28Author Commented:
one more thing I must mention that the exes are all on the server, so its only about triggering them from the client. The path etc. are all known.
0
Ron MalmsteadInformation Services ManagerCommented:
Here's an example of creating remote process execution..
http://bytes.com/groups/net-vb/387736-remote-process-execution-vb-net

Here's another that uses WMI create process in VB .net
Dim strcomputer as string = "ServerName"
Dim execMon As String = "C:\Locale\Monday.exe "
Dim scope As ManagementScope = New ManagementScope("\\" & _
strComputer & "\root\cimv2", cOptions)

Try
scope.Connect()
Catch ex2 As Exception
MsgBox("Failed to connect to " & strComputer)
End Try

Try
Dim mPath As ManagementPath = New
ManagementPath("Win32_Process")
Dim mClass As ManagementClass = New
ManagementClass(scope, mPath, New ObjectGetOptions(Nothing, New TimeSpan(0,
0, 0, 7), True))
Dim inParams2 As ManagementBaseObject =
mClass.GetMethodParameters("Create")
Dim options As InvokeMethodOptions = New
InvokeMethodOptions
inParams2("CommandLine") = execMon & uChkS & " " & cChkS
Dim mboMon As ManagementBaseObject =
mClass.InvokeMethod("Create", inParams2, options)
Dim processIDMon As Object = mboMon("processID")
'MsgBox(processIDMon.ToString)
Catch ex As Exception
MsgBox("Failed to execute application. Error message: " 
& ex.message)
End Try

0
Managing Security & Risk at the Speed of Business

Gartner Research VP, Neil McDonald & AlgoSec CTO, Prof. Avishai Wool, discuss the business-driven approach to automated security policy management, its benefits and how to align security policy management with business processes to address today's security challenges.

kunal_hopra28Author Commented:
doesnt work. Just hangs....Im running as the same account that is logged into the remote machine. Any idea why this would be?
0
Ron MalmsteadInformation Services ManagerCommented:
Process hangs ?...or your dev program is hanging ?... does the process get executed ? (watch task manager)
0
kunal_hopra28Author Commented:
Yes. my dev program is hanging and I dont see the the application started on the remote machine...
0
Ron MalmsteadInformation Services ManagerCommented:
i would look for more examples if you believe the code is wack.  I don't do csharp... but running a remote process is a very common thing, and there are plenty of examples out there....and even utilities you can use.. like psexec.

Why reinvent the wheel...?...use psexec
0
Ron MalmsteadInformation Services ManagerCommented:
0
kunal_hopra28Author Commented:
so PSKill is starting the process for me. But I dont see the application - notepad etc. opened on the machine. Do you have a way to do that.

Kunal
0
Ron MalmsteadInformation Services ManagerCommented:
No....

Unfortunately... I don't know of a way to make a GUI pop on the users screen.  The application runs in the background.

0
Ron MalmsteadInformation Services ManagerCommented:
Here's some people claiming to make it work with psexec using the -i  option...
http://forum.sysinternals.com/forum_posts.asp?TID=18881
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kunal_hopra28Author Commented:
This worked very well. Thanks a bunch for your help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.