public string ADTest(MainWindow m) { bool test = false; string domainName = String.Empty; string result = String.Empty; DCMGToolbox.ActiveDirectory ad = new ActiveDirectory(); DCMGToolbox.Network net = new Network(); try { m.WriteLogs("Checking for domain"); domainName = ad.GetDomainName(); m.WriteLogs("Domain: " + domainName); if (domainName != String.Empty) { m.WriteLogs("Domain Found Attempting to Ping", Logging.LogType.Success); test = net.Pingable(domainName); } else { m.WriteLogs("Domain Not Found or doesnt exist", Logging.LogType.Warning); domainName = "NA"; } if (test == true && domainName != "NA") { m.WriteLogs("Domain found and pingable", Logging.LogType.Success); result = "pingable || " + domainName; } else { m.WriteLogs("Domain found but not pingable", Logging.LogType.Error); result = "notpingable || " + domainName; } } catch (Exception ex) { m.WriteLogs(ex.Message, Logging.LogType.Critical); result = "Exception || " + ex.Message; } return(result); }