Creation date of users in AD

Posted on 2007-07-22
Last Modified: 2012-08-14
Does any one know how i can export a list of users from AD including the creation date and the last time the password was changed?
Question by:tollair
    LVL 19

    Accepted Solution

    Purpose: To create a CSV listing of all users in Active Directory, listing whether the account is disabled or enabled, provide both first and last name for sorting, and list the last time the password on the account was reset, allowing for the flagging of accounts that need to be investigated and/or disabled

    this will get specific user object details including creations time. you can incorporate the two if needed

    Set objUser = GetObject _
    strWhenCreated = objUser.Get("whenCreated")
    strWhenChanged = objUser.Get("whenChanged")
    Set objUSNChanged = objUser.Get("uSNChanged")
    dblUSNChanged = _
        Abs(objUSNChanged.HighPart * 2^32 + objUSNChanged.LowPart)
    Set objUSNCreated = objUser.Get("uSNCreated")
    dblUSNCreated = _
        Abs(objUSNCreated.HighPart * 2^32 + objUSNCreated.LowPart)
    objUser.GetInfoEx Array("canonicalName"), 0
    arrCanonicalName = objUser.GetEx("canonicalName")
    WScript.echo "Canonical Name of object:"
    For Each strValue in arrCanonicalName
        WScript.Echo vbTab & strValue
    WScript.Echo "Object class: " & objUser.Class
    WScript.echo "When Created: " & strWhenCreated & " (Created - GMT)"
    WScript.echo "When Changed: " & strWhenChanged & " (Modified - GMT)"
    WScript.Echo "USN Changed: " & dblUSNChanged & " (USN Current)"
    WScript.Echo "USN Created: " & dblUSNCreated & " (USN Original)"

    Author Comment

    thanks for that, are you able to add in code for OU for each user as well?

    Author Comment

    Just one more thing, the output doesn't show the creation date.
    LVL 19

    Expert Comment

    one question are you familiar with vbs and how to modify it?  if so you can pull the code from the first script to search the entire AD infrastructure for the second code.. or combine them into one. may have one available already.

    the real question is why do you need this information?will it be used with other information, i may have a script that does what you need this to do.
    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    One of the major disadvantages of still running XP in production is its lack of Internet Explorer Favourites directory redirection. If your users frequently roam between computers, the usual workaround is to enable Roaming Profiles to have the favou…
    I know all systems administrator at some time or another has had to create a script to copy file from a server share to a desktop. Well now there is an easy way to do this in Group Policy. Using Group policy preferences is not hard. The first thing …
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now