static void Main(string[] args) { try { if (stringDomainName != null) { string[] info = TextProcessing.login(); while (true) { if (validateUser(info[0], info[1])) { goto PROCESS; } else { Console.Clear(); Console.Write("Invalid username or password. Try Again. (y/n): "); string key = Console.ReadLine().ToUpper(); if (key.Equals("Y") || key.Equals("YES")) { info = TextProcessing.login(); } else if (key.Equals("N") || key.Equals("NO")) { goto END; } } } PROCESS: Console.Clear(); Console.WriteLine("Welcome!"); while (true) { Console.Write("Please select feature:\n[1]Show OU\n[2]Show User\n[3]Show Computer\n[4]Show Groups\n[5]Exit\n:"); string choose = Console.ReadLine(); switch (choose) { case "1": OU.Clear(); OU = getOU(); foreach (string nameOU in OU) { Console.WriteLine(nameOU); } break; case "2": Users.Clear(); Users = getUsers(); foreach (User user in Users) { Console.WriteLine(user.SAMAccountName + " - " + user.commonName + " - " + user.ou); } break; case "3": Computers.Clear(); Computers = getComputer(); foreach (string computer in Computers) { Console.WriteLine(computer); } break; case "4": Groups.Clear(); Groups = getGroup(); foreach (string group in Groups) { Console.WriteLine(group); } break; case "5": Console.WriteLine("===================="); goto END; default: break; } Console.WriteLine("===================="); } END: Console.WriteLine("Goodbye!"); } else { Console.WriteLine("Your computer is not a member of domain"); } } catch (Exception e) { Console.WriteLine(e); } }