Follow the steps in Recipe 4.2.
Ensure that
createTimestamp
andmodifyTimestamp
are included in the list of attributes to be returned by looking at Attributes under Options → Search.
' This code prints the created and last modified timestamp
' for the specified object.
' ------ SCRIPT CONFIGURATION ------
strObjectDN = "<ObjectDN>
"
' ------ END CONFIGURATION ---------
set objEntry = GetObject("LDAP://" & strObjectDN)
Wscript.Echo "Object Name: " & objEntry.Get("name")
Wscript.Echo " Created: " & objEntry.Get("createTimestamp")
Wscript.Echo " Changed: " & objEntry.Get("modifyTimestamp")
When an object is created or modified in Active Directory, the
createTimestamp
and
modifyTimestamp
attributes get set with the
current time. Those two attributes are replicated, so assuming the
latest modification of the object in question has replicated to all
domain controllers, they will contain the absolute create and last
modified timestamps.
You may have also run across the whenCreated
and
whenChanged
attributes. They also contain create
and modify timestamps, but these values are local to the domain
controller and are not replicated.
Recipe 4.2 for viewing the attributes of an object
Get Active Directory Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.