Run the process as LocalSystem using ProcessStartInfo

I am trying to start a process as a 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 always get the same error message "Login failed: unknown username or invalid password." The user calling the function is the local administrator and must be able to start the process using system privileges. I also tried a different combination, but no luck.

I would appreciate any help. thank

+5
source share
2 answers

Unfortunately, I don’t think you can do it that simple.

API, Process.Start(), , SYSTEM , , API.

- psexec ( , , Process.Start()).

+3

. . , - . . /.

0

All Articles