示例#1
0
        public void GetUsers()
        {
            Domain domain = Domain.GetCurrentDomain();
            var    d      = new ADDomain(domain.Name.ToString());
            var    users  = d.GetADUsers();

            if (users.Count > 0)
            {
                foreach (ADUser u in users)
                {
                    Console.WriteLine(u.Displayname + ", " + u.AccountStatus);
                }
            }

            // Alternative approach
            //var users = d.GetADUsersManagement();
            //if (users.Count > 0)
            //{
            //    foreach (ADUser u in users)
            //    {
            //        Console.WriteLine(u.Displayname + ", " + u.AccountStatus);
            //    }
            //}
        }