【问题标题】:Run process with different user for first time when user profile is not created未创建用户配置文件时,首次使用不同用户运行进程
【发布时间】:2016-02-12 02:43:04
【问题描述】:

我正在使用下面的代码来运行具有不同用户的进程。当用户配置文件已经存在或用户登录系统时它工作正常,但是当用户没有登录到该系统时它会出现问题,因为用户配置文件不存在。 我该如何解决这个问题?

        ProcessStartInfo myProcess = new ProcessStartInfo(@"C:\Program Files\Internet Explorer\iexplore.exe");
        myProcess.UserName = username;
        myProcess.Password = MakeSecureString(password);
        myProcess.UseShellExecute = false;
        Process.Start(myProcess);

【问题讨论】:

    标签: c# user-profile


    【解决方案1】:

    尝试设置 myProcess.LoadUserProfile = true。我遇到了类似的问题,设置此属性能够解决我的问题。

    【讨论】:

      猜你喜欢
      • 2012-07-14
      • 2019-03-15
      • 2023-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-24
      • 2023-03-03
      相关资源
      最近更新 更多