Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ProcessStartInfo p = new ProcessStartInfo();
- p.WorkingDirectory = @"C:WindowsSystem32";
- p.FileName = @"C:WindowsSystem32cmd.exe";
- p.UserName = "myUser";
- p.Domain = "myDomain";
- char[] password = { 'm', 'y', 'p', 'a', 's', 's'};
- SecureString adminpassword = new SecureString();
- foreach (char c in password)
- {
- adminpassword.AppendChar(c);
- }
- p.Password = adminpassword;
- p.UseShellExecute = false;
- p.Verb = "runas";
- Process.Start(p);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement