Process.Start() not spawning new process under the same user

I was always under the impression that when you're running a process as (domainuser) mydomainmyuser , when using Process.Start() it would start this new process using the same credentials - mydomainmyuser .

The issue I'm having is that my Process.Start() call seems to be creating a process under the SYSTEM account which is causing me permission issues in the started process (which must run under an admin account due to the work it does). If it changes things - I'm spawning this process (a custom built exe) from within a windows installer .

Any suggestions? I've read about windows group policies (possibly) having an impact on this, but if I'm honest, it's lost on me.

EDIT: a little snippet:

Where exename and commandLine are parameters for this method body:

ProcessStartInfo procInfo = new ProcessStartInfo(exeName, commandLine);
procInfo.WorkingDirectory = workingDirectory;
procInfo.UseShellExecute = false;
procInfo.CreateNoWindow = true;
Process process = Process.Start(procInfo);
Process.WaitForExit();
return process.ExitCode;

Either set procInfo.UseShellExecute to true, or execute cmd as a process with your exe as a parameter to the cmd command. When UseShellExecute is set to false, here are a lot of interesting side effects: UseShellExecute


Your impression is true. Process.Start() will always start the new process under current user's credentials - unless you provide alternative credentials in the ProcessStartInfo or use one of the overloads that take credentials.

There must be another problem - share a snippet of your code.

UPDATE

OK! You did not mention anything about installer. All MSI installers will be running under system since they will be run by " Windows Installer " which you can check and they run under SYSTEM .

链接地址: http://www.djcxy.com/p/61106.html

上一篇: 如何在当前用户下启动一个进程?

下一篇: Process.Start()不会在同一用户下产生新的进程