Guest User

Untitled

a guest
Jul 27th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. Starting another process with elevation using different user credentials
  2. ProcessStartInfo info = new ProcessStartInfo(path);
  3.  
  4. info.UseShellExecute = false;
  5. info.UserName = username;
  6. info.Password = securePwd;
  7. info.Domain = "MyDomain";
  8. info.Verb = "runas";
  9.  
  10. var proc = Process.Start(info);
  11.  
  12. ProcessStartInfo info = new ProcessStartInfo(path);
  13.  
  14. info.UseShellExecute = false;
  15. info.UserName = username;
  16. info.Password = securePwd;
  17. info.Domain = "MyDomain";
  18. info.Verb = "runas";
  19. info.WorkingDirectory = "c:\directory\contains\process_to_be_started"
  20.  
  21. 'var proc = Process.Start(info);
  22.  
  23. Process proc = Process.Start(info);
Add Comment
Please, Sign In to add comment