Advertisement
Guest User

Untitled

a guest
Aug 11th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. System.Security.SecureString ssPwd = new SecureString();
  2. string userName = "*****";
  3. string password = "*********";
  4. string domain = "******";
  5.  
  6. for (int x = 0; x < password.Length; x++)
  7. {
  8. ssPwd.AppendChar(password[x]);
  9. }
  10. try
  11. {
  12.  
  13. var p = new Process
  14. {
  15. StartInfo =
  16. {
  17. UseShellExecute = false,
  18. RedirectStandardOutput = true,
  19. FileName =Path.Combine(ConfigurationManager.AppSettings["ActiveMqAdminLocation"], "activemq-admin.bat"),
  20. WorkingDirectory =System.IO.Directory.GetCurrentDirectory(),
  21.  
  22. }
  23. };
  24. var command = "query -QQueue="+ queueName;
  25. if (!string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["ActiveMqBrokerUri"]))
  26. {
  27. command += " --jmxurl " + ConfigurationManager.AppSettings["ActiveMqBrokerUri"];
  28. }
  29.  
  30. p.StartInfo.UserName = userName;
  31. p.StartInfo.Domain = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
  32. p.StartInfo.Password = ssPwd;
  33. p.StartInfo.Arguments = command;
  34. p.Start();
  35. string output = p.StandardOutput.ReadToEnd();
  36. if (! (output.Contains(server)))
  37. {
  38. Log.InfoFormat("Not Connected");
  39. return false;
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement