Results 1 to 2 of 2

Thread: Active Directory Inactive User Detection

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2004
    Posts
    70

    Active Directory Inactive User Detection

    Hi all, I know that I could use System.DirectoryServices to gain access to Active Directory using c#. Now here is my question, do anybody know which method I could use to detect inactive user accounts? If you are aware of, every time the user creating a new user accounts, there will be a account varification which will sent you an Email to redirect you to the website to complete the varification. My intension is to delete those user accounts that created but did not complete the varification part, and also the user who never log in within the pass 30days. Thanks for any input, will be helpful if you guy can give some comments.

    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.DirectoryServices;
    
    
    namespace RemoveInactiveADUser
    {
        public class DeleteObject
        {
            public static void Main()
            {
                DirectoryEntry de = new DirectoryEntry(
                  "LDAP://192.168.1.100/ou=accounting, dc=ispnet1, dc=net",
                  "cn=Administrator, dc=ispnet1, dc=net", "password",
                  AuthenticationTypes.ServerBind);
    
                DirectoryEntries children = de.Children;
                try
                {
                    DirectoryEntry badObject = children.Find("ou=auditing");
                    badObject.DeleteTree();
                    de.CommitChanges();
                    Console.WriteLine("the object has been deleted");
                }
                catch (Exception e)
                {
                    Console.WriteLine("the object was not found or deleted:");
                    Console.WriteLine(e.ToString());
                }
            }
        }
    
    }

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Aug 2004
    Posts
    70

    Re: Active Directory Inactive User Detection

    is it very hard to achive that?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width