我有一个从主应用程序生成的子进程,需要在 Windows 7 机器上作为另一个本地用户运行。我宁愿不在该用户帐户上设置密码,但似乎使用模拟创建新进程不允许使用空白密码或任何类型的空值。有谁知道这是否可能?
下面是我尝试传递一个空白字符:
ProcessStartInfo info = new ProcessStartInfo(@"C:\PathToExecutable");
System.Security.SecureString psswd = new System.Security.SecureString();
psswd.AppendChar('\0');
psswd.MakeReadOnly();
info.UseShellExecute = false;
info.UserName = "NewProcessName";
info.Password = psswd;
info.Domain = "LocalMachine";
Process newProc = new Process();
newProc.StartInfo = info;
newProc.Start();
编辑:我收到的错误消息
Logon failure: user account restriction. Possible reasons are blank passwords not allowed, logon hour restrictions, or a policy restriction has been enforced