Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i want to run a executable file on remote system via process.start
i used this commands but i saw 2erors
unknown username or bad password
the specify path is not recognized.
how to perfect this commands to solve this problems
or any solution for execute remotely via C#?

C#
 System.Diagnostics.ProcessStartInfo proc_sg = new System.Diagnostics.ProcessStartInfo();
                proc_sg.FileName ="filename.exe";

                proc_sg.CreateNoWindow= true ;
              proc_sg.UserName = txt_user.Text.ToString();;
              proc_sg.UseShellExecute =false  true;
              proc_sg.Verb = "runas";
              SecureString pwd = new SecureString();
              string p2 = txt_pass.Text.ToString();
                foreach (char item in p2 )
                {
                    pwd.AppendChar(item);
                }
                pwd.MakeReadOnly();*/
                proc_sg.WorkingDirectory = "\\\\ip_remote pc\\folder";
                proc_sg.WindowStyle = ProcessWindowStyle.Maximized;
Process.Start(proc_sg);


Thanks
Posted
Updated 10-Dec-10 20:28pm
v3
Comments
Abdul Quader Mamun 11-Dec-10 2:29am    
Use pre Tag for better reading.

First, you cannot run a interactive remote process, so if you were trying to launch something the user on the remote machine could see, you can't.

Think about that the HUGE security risk this is if you could get any Windows machine to run any code you wanted without the user launching it...

You're not assigning the password to the ProcessStartInfo object you created (proc_sg). You only assigned a username.

Also, if the remote machine is not in the same domain or is in a workgroup configuration, the username and password must exist in the account database of the remote machine.
 
Share this answer
 
hi and thanks for your answer
i have a correct privilieage in the account database and setit for this connection and the folder be shared and i can launched this folder
but
i want to execute this file from my clients of my network
nnow have any solutions?
thanksa
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900