Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.Security.SecureString ssPwd = new SecureString();
- string userName = "*****";
- string password = "*********";
- string domain = "******";
- for (int x = 0; x < password.Length; x++)
- {
- ssPwd.AppendChar(password[x]);
- }
- try
- {
- var p = new Process
- {
- StartInfo =
- {
- UseShellExecute = false,
- RedirectStandardOutput = true,
- FileName =Path.Combine(ConfigurationManager.AppSettings["ActiveMqAdminLocation"], "activemq-admin.bat"),
- WorkingDirectory =System.IO.Directory.GetCurrentDirectory(),
- }
- };
- var command = "query -QQueue="+ queueName;
- if (!string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["ActiveMqBrokerUri"]))
- {
- command += " --jmxurl " + ConfigurationManager.AppSettings["ActiveMqBrokerUri"];
- }
- p.StartInfo.UserName = userName;
- p.StartInfo.Domain = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
- p.StartInfo.Password = ssPwd;
- p.StartInfo.Arguments = command;
- p.Start();
- string output = p.StandardOutput.ReadToEnd();
- if (! (output.Contains(server)))
- {
- Log.InfoFormat("Not Connected");
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement