/// <summary>
        /// Hàm lấy thông tin các OU trong Domain mà Computer này đang tham gia
        /// </summary>
        /// <returns>
        /// Trả về List chứa các OU
        /// </returns>
        private static List <string> getOU()
        {
            List <string>     list      = new List <string>();
            DirectorySearcher dSearcher = new DirectorySearcher(dEntry);

            dSearcher.Filter = "(&(objectClass=organizationalUnit))";
            foreach (SearchResult result in dSearcher.FindAll())
            {
                list.Add(TextProcessing.getProperty(result, "ou"));
            }
            dSearcher.Dispose();
            return(list);
        }
        /// <summary>
        /// Hàm lấy thông tin các Groups trong Domain mà Computer này đang tham gia
        /// </summary>
        /// <returns>
        /// Trả về danh sách các Group
        /// </returns>
        private static List <string> getGroup()
        {
            List <string>     list      = new List <string>();
            DirectorySearcher dSearcher = new DirectorySearcher(dEntry);

            dSearcher.Filter = "(&(objectClass=group))";

            foreach (SearchResult sResult in dSearcher.FindAll())
            {
                list.Add(TextProcessing.getProperty(sResult, "cn"));
            }
            dSearcher.Dispose();
            return(list);
        }
        /// <summary>
        /// Hàm lấy thông tin các User trong Domain mà Computer này đang tham gia
        /// </summary>
        /// <returns>
        /// Trả về List các User
        /// </returns>
        private static List <User> getUsers()
        {
            List <User>       list      = new List <User>();
            DirectorySearcher dSearcher = new DirectorySearcher(dEntry);

            dSearcher.Filter = "(&(objectClass=user))";
            foreach (SearchResult result in dSearcher.FindAll())
            {
                list.Add(new User {
                    SAMAccountName = TextProcessing.getProperty(result, "SAMAccountName"),
                    commonName     = TextProcessing.getProperty(result, "cn"),
                    ou             = TextProcessing.getOU(TextProcessing.getProperty(result, "distinguishedname"))
                });
            }
            return(list);
        }
        private static List <string> getComputer()
        {
            List <string>     list      = new List <string>();
            DirectorySearcher dSearcher = new DirectorySearcher(dEntry);

            dSearcher.Filter = "(&(objectClass=computer))";

            foreach (SearchResult sResult in dSearcher.FindAll())
            {
                list.Add(TextProcessing.getProperty(sResult, "cn"));
            }
            dSearcher.Dispose();
            MethodBase       method = MethodBase.GetCurrentMethod();
            CustomAttributes attr   = (CustomAttributes)method.GetCustomAttributes(typeof(CustomAttributes), true)[0];

            //Console.WriteLine("Attr OUname: "+attr.getOUname());
            return(list);
        }
        private static void showUsers()
        {
            DirectorySearcher dSearcher = new DirectorySearcher(dEntry);

            //dSearcher.Filter = "(&(objectClass=user)(SAMAccountName=tuanle2))";
            dSearcher.Filter = "(&(objectClass=group))";

            foreach (SearchResult sResult in dSearcher.FindAll())
            {
                Console.WriteLine(TextProcessing.getProperty(sResult, "cn") + " - " + TextProcessing.getProperty(sResult, "SAMAccountName"));
                //var name = sResult.Properties["distinguishedname"][0];
                //Console.WriteLine(TextProcessing.getProperty(sResult, "distinguishedname"));

                /*foreach (string key in sResult.Properties.PropertyNames)
                 * {
                 *  foreach (Object myColl in sResult.Properties[key])
                 *  {
                 *      Console.WriteLine(key + ": " + myColl);
                 *  }
                 * }*/
            }
            dSearcher.Dispose();
        }