Guest User

Untitled

a guest
May 24th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
  2. <security>
  3. <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
  4. <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
  5. </requestedPrivileges>
  6. </security>
  7. </trustInfo>
  8.  
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Text;
  12. using System.IO;
  13. using System.Diagnostics;
  14.  
  15. namespace ConsoleApplication1
  16. {
  17. class Program
  18. {
  19. [STAThread]
  20. static void Main(string[] args)
  21. {
  22. var processes = Process.GetProcesses();
  23.  
  24. uint c_error = 0;
  25.  
  26. foreach (Process pr in processes)
  27. {
  28. using (pr)
  29. {
  30. Console.Write(pr.ProcessName.PadLeft(25));
  31. try
  32. {
  33. Console.Write("tRunning: " + DateTime.Now.Subtract(pr.StartTime).TotalHours.ToString("F3") + " hours ");
  34. }
  35. catch (Exception ex)
  36. {
  37. Console.Write("t" + ex.Message);
  38. c_error++;
  39. }
  40.  
  41. try
  42. {
  43. Console.Write("tHasExited: " + pr.HasExited.ToString());
  44. }
  45. catch (Exception ex)
  46. {
  47. Console.Write("t" + ex.Message);
  48. c_error++;
  49. }
  50. Console.WriteLine();
  51. }
  52. }
  53.  
  54. Console.WriteLine();
  55. Console.WriteLine("Processes: {0}, Errors: {1}",
  56. processes.Length, c_error);
  57.  
  58. Console.ReadKey();
  59. }
  60. }
  61. }
Add Comment
Please, Sign In to add comment