我试图使用不同的用户(而不是服务用户)从C#服务运行djoin.exe
工具和System.Diagnostics.Process
。不能以不同的用户身份运行C#进程
该过程返回代码-1073741502
。
在事件日志中我可以看到:
应用程序弹出:djoin.exe - 应用程序错误:应用程序 无法正常启动(0xc0000142)。单击确定关闭 应用程序。
没有stderr或stdout。
这里是我使用的工艺配置:
ProcessStartInfo startInfo = new ProcessStartInfo
{
Arguments = "/Provision /Domain domain.com /Machine PC12 /SaveFile NUL /printblob",
WorkingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
FileName = "djoin.exe"
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardInput = true,
RedirectStandardOutput = true,
CreateNoWindow =true,
Domain = "domain.com",
UserName = "other-user",
Password = "***"
};
if (username!=null)
{
startInfo.Domain = domain;
startInfo.UserName = username;
startInfo.Password = ToSecureString(password);
}
p = new Process { StartInfo = startInfo };
p.Start();
当使用RUNAS
命令,一切工作正常。
什么问题?
这是什么版本的Windows?而且,你的应用程序是否拥有更高的特权 – 2014-09-28 18:40:47
Windows 2008服务器R2。这是一项服务。你是什么意思提升特权? – Igal 2014-09-28 21:44:21
该程序使用的某个DLL的DllMain()入口点返回FALSE。它不高兴,你不知道为什么,除非它在应用程序事件日志中留下消息。不好的可能性你会找到一个。你没有足够的旋钮来调整,尽管你绝对应该尝试将LoadUserProfile设置为* true *。请联系作者或应用程序的所有者以获取帮助。 – 2014-09-28 23:41:35