0

I want to load a new user profile from a domain. I start a new process as another user like this :

SecureString Secure = new SecureString();
Secure.AppendChar('*');
Secure.AppendChar('*');
Secure.AppendChar('*');
Secure.AppendChar('*');
Secure.AppendChar('*');
Secure.AppendChar('*');

Process RunAs = new Process();
RunAs.StartInfo.FileName = "iexplore.exe";
RunAs.StartInfo.Domain = "mydomain";
RunAs.StartInfo.UserName = "myUser";
RunAs.StartInfo.Password = Secure;
RunAs.StartInfo.LoadUserProfile = true;
RunAs.StartInfo.UseShellExecute = false;
RunAs.Start();

But i have ever the same error : "System.ComponenetModel.Win32Exception : 'Specified file not found'"

I have try to change the StartInfo.FileName with the full path or add a StartInfo.WorkingDirectory, but ever the same error.

The same topic : Error in Process.Start() — The system cannot find the file specified Say to try with a start info i have try this :

SecureString Secure = new SecureString();
Secure.AppendChar('*');
Secure.AppendChar('*');
Secure.AppendChar('*');
Secure.AppendChar('*');
Secure.AppendChar('*');
Secure.AppendChar('*');

ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\Program Files\Internet Explorer\iexplore.exe");

startInfo.Domain = "myDomain";
startInfo.UserName = "myUser";
startInfo.Password = Secure;
startInfo.UseShellExecute = false;
startInfo.LoadUserProfile = true;

Process.Start(startInfo);

But the exception is the same on the last line "Process.Start(startInfo)" Anybody can help me about that ?

Kaikon
  • 26
  • 4

0 Answers0