小编auh*_*orn的帖子

使用ProcessStartInfo以LocalSystem启动进程

我正在尝试使用此代码作为LocalSystem帐户启动进程

    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();
}
Run Code Online (Sandbox Code Playgroud)

但我总是得到相同的错误消息"登录失败:未知用户名或密码错误".调用该函数的用户是本地管理员,应该能够启动具有本地系统特权的进程.我也试过不同的组合,但没有运气.

我将不胜感激任何帮助.谢谢

.net c#

7
推荐指数
1
解决办法
7724
查看次数

5
推荐指数
1
解决办法
964
查看次数

标签 统计

.net ×1

c# ×1

f# ×1

f#-3.0 ×1

type-providers ×1