Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. var proc = new Process
  2. {
  3. StartInfo = new ProcessStartInfo
  4. {
  5. FileName = GetASDeploymentExe(),
  6. Arguments = GetASDeploymentCmdArgs(),
  7. UseShellExecute = false,
  8. RedirectStandardOutput = true,
  9. RedirectStandardError = true,
  10. CreateNoWindow = true,
  11. Domain = "***",
  12. UserName = username,
  13. Password = secstr,
  14. Verb = "runas"
  15. }
  16. };
  17.  
  18. proc.Start();
  19. config.ASDeploymentToolPID = proc.Id;
  20.  
  21. string line = string.Empty;
  22. do
  23. {
  24. line = proc.StandardOutput.ReadLine();
  25. Console.WriteLine(line);
  26. } while (!proc.HasExited);
  27.  
  28. string error = string.Empty;
  29. while (!proc.StandardError.EndOfStream)
  30. {
  31. error = proc.StandardError.ReadLine();
  32. Logger.WriteError(error);
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement