Start a process as LocalSystem using ProcessStartInfo
Posted
by auhorn
on Stack Overflow
See other posts from Stack Overflow
or by auhorn
Published on 2010-04-23T08:31:30Z
Indexed on
2010/04/23
8:33 UTC
Read the original article
Hit count: 1041
I am trying to start a process as the LocalSystem account using this code
ProcessStartInfo _startInfo = new ProcessStartInfo(commandName);
_startInfo.UseShellExecute = false;
_startInfo.UserName = @"NT AUTHORITY\SYSTEM";
_startInfo.CreateNoWindow = true;
_startInfo.Arguments = argument;
_startInfo.RedirectStandardOutput = true;
using (Process _p = Process.Start(_startInfo)) {
_retVal = _p.StandardOutput.ReadToEnd();
_p.WaitForExit();
}
But I am getting always the same error message saying "Logon failure: unknown user name or bad password". The user calling the function is a local admin and should be able to start a process with local system privilege. I also tried different combination but no luck.
I would appreciate any help. Thanks
© Stack Overflow or respective owner