C #: تحميل التشكيل الجانبي المتجول وتنفيذ برنامج كمستخدم

StackOverflow https://stackoverflow.com/questions/337159

سؤال

في تطبيق ولست بحاجة إلى تنفيذ برامج أخرى مع أوراق اعتماد مستخدم آخر. حاليا أنا استخدم على System.Diagnostics.Process.Start لتنفيذ البرنامج:

public static Process Start(
   string fileName,
   string arguments,
   string userName,
   SecureString password,
   string domain
)

ولكن هذه الوظيفة لا يتم تحميل التشكيل الجانبي المتجول من الشباك - وهو مطلوب

وأتمكن من استخدام "RUNAS / ملف ..." لتحميل التشكيل الجانبي وتنفيذ الأمر، ولكن من شأنه أن تسأل عن كلمة السر. يجب أن يكون هناك طريقة أكثر أناقة ...

ولكن أين؟

هل كانت مفيدة؟

نصائح أخرى

وبلدي حل (هذه البيانات تعتمد على تلميح leppie ل):

        Process p = new Process();

        p.StartInfo.FileName = textFilename.Text;
        p.StartInfo.Arguments = textArgument.Text;
        p.StartInfo.UserName = textUsername.Text;
        p.StartInfo.Domain = textDomain.Text;
        p.StartInfo.Password = securePassword.SecureText;

        p.StartInfo.LoadUserProfile = true;
        p.StartInfo.UseShellExecute = false;

        try {
            p.Start();
        } catch (Win32Exception ex) {
            MessageBox.Show("Error:\r\n" + ex.Message);
        }
scroll top