Viewing the Created and Last Modified Timestamp of an Object

Viewing the Created and Last Modified Timestamp of an Object


You want to determine when an object was either created or last updated.


Using a graphical user interface
  1. Follow the steps in Recipe 4.2.

  2. Ensure that createTimestamp and modifyTimestamp are included in the list of attributes to be returned by looking at Attributes under Options Search.

Using a command-line interface

You can view the created and modified timestamps using the built-in DSQuery utility, as well as AdFind. For DSQuery, use the following syntax:

	> dsquery * "<ObjectDN>" -attr name createTimestamp modifyTimestamp

For AdFind, use the following:

	> adfind default rb cn=Users f "cn=Joe Smith"  

Using VBScript
	' This code prints the created and last modified timestamp
	' for the specified object.
	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. The createTimestamp attribute is replicated between domain controllers, so assuming the latest modification of the object in question has replicated to all domain controllers, they will all contain the timestamp when the object was created. (modifyTimestamp is not replicated.)

See Also

Recipe 4.2 for viewing the attributes of an object, Chapter 13 for a more detailed description of the Active Directory replication process, and Active Directory, Third Edition, by Joe Richards et al. (O'Reilly)

 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows