Click here to Skip to main content
14,300,111 members
Rate this:
Please Sign up or sign in to vote.

I am developing an application where I need to open an .exe, which is on remote computer.

Can anyone please suggest me how to do this.

i tried opening .exe on local machine..and its working fine.

here is the code for that..!!
Process myProcess = new Process();
             myProcess.StartInfo.UseShellExecute = false;
            myProcess.StartInfo.FileName = @"C:WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe";

What I have tried:

I created windows application and I want to open .exe file on remote computer using a button click.
Updated 31-May-16 5:53am
Philippe Mori 25-May-16 19:55pm
Stop writing spam software. We do not need such software.
Rate this:
Please Sign up or sign in to vote.

Solution 1

The short answer is you can't, for rather obvious security reasons.

You CAN launch an .EXE on a remote machine only if you have admin access to the remote machine AND it is NOT a user interactive process. The user on the remote machine will NEVER see the UI.
Member 12478311 25-May-16 12:41pm
I have admin access..!!
Dave Kreskowiak 25-May-16 12:42pm
So what? The user on that machine will NEVER see if running. This is to prevent someone from compromising security and getting a malicious .EXE running on the client that asks for users credentials.
Dave Kreskowiak 25-May-16 12:43pm
Oh, and the Process class cannot be used to do it. It must be done through WMI and the "Win32_Process" class.
Member 12478311 25-May-16 12:44pm
I have .exe file on remote machine..
and I want to open it from my machine with a button click..
Dave Kreskowiak 25-May-16 12:46pm
Yeah, and? I already told you why this is not going to happen.
Sergey Alexandrovich Kryukov 25-May-16 17:46pm
The answer is a bit inaccurate. There is no difference if the application is interactive or not, console or not, and so on. The application is loaded from the storage on remote machine and run on the machine where one tries to start the application. If it's behavior depends on the location of executable files, it can show some difference, but generally its runtime has nothing to do with the remote machine. Everything happens on the machine where the application is started.
Dave Kreskowiak 25-May-16 18:37pm
I'm taking this as he's trying to launch an executable on a remote machine so that it's visible to the user logged into the remote machine. That's not going to happen.
Sergey Alexandrovich Kryukov 25-May-16 19:07pm
I know; of course it's not going to happen. It's just unrelated to "interactive".
Dave Kreskowiak 25-May-16 19:27pm
It probably wasn't the best description. You can still launch a remote process, but if the process sits and waits for user interaction, like a Windows Forms app, it'll never get any.
Sergey Alexandrovich Kryukov 25-May-16 22:17pm
Well, it can be opened on the machine starting the application and get all the user interaction... :-)
Member 12478311 25-May-16 18:36pm
Can I open using WCF Service..??
Dave Kreskowiak 25-May-16 18:36pm
No, same problem.
Rate this:
Please Sign up or sign in to vote.

Solution 2

I got it working..and I did it by adding ProcessExtensions.cs to my service, and opened the .exe with service.

Thought that this may be useful to someone :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100