-
[2.0] Psi
I'm trying to run a process on another computer giving it user credentials however I always get the username or bad password exception. Any ideas what im doing wrong?
ProcessStartInfo psi = new ProcessStartInfo("notepad");
psi.Username = "Administrator";
psi.Password = theSecureString;
psi.Domain = "ComputerName";
psi.LoadUserProfile = true;
psi.UseShellExecute = false;
Process.Start(psi);
of course the username and password are correct.
any ideas?
-
Re: [2.0] Psi
I could be wrong but I don't think that you can use Process.Start to start a process on another machine. I think that the Domain property indicates the domain in which the user credentials are valid, not the computer on which to run the process. I think that that code is trying to run a process on the local machine using the credentials that you're specifying, which are probably invalid for the local machine.
-
Re: [2.0] Psi
could be.
I know I can run a process using WMI in C# but I want it to automatically "appear" if the user is already logged in instead of running it in the background on a different account for example.....
-
Re: [2.0] Psi
I don't see that Process.Start would realy help there because you'd still have to determine who the logged on user was in order to the start the process as that user. I don't know for sure but I'd expect that WMI could do that just as easily.
I looked a little further because I thought that this should be possible and it's not the ProcessStartInfo you need to adjust. I think something like this should work:
Code:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.MachineName = "MachineName";
proc.StartInfo.UserName = "UserName";
// etc.
proc.Start();