Creation date of users in AD

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?
Who is Participating?
William ElliottSr Tech GuruCommented:
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)"
tollairAuthor Commented:
thanks for that, are you able to add in code for OU for each user as well?
tollairAuthor Commented:
Just one more thing, the output doesn't show the creation date.
William ElliottSr Tech GuruCommented:
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.
Forced accept.

EE Admin
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.