Printout Header
RSS Feed

Attributes for AD Users : uSNChanged

The Active Directory attribute uSNChanged stores the local update sequence number (USN) of the regarding domain controller at the time of last update on that user object. Since each DC has its own USN values, the value of uSNChanged for a user differs on each domain controller - the attribute is not replicated between DCs!


LDAP name uSNChanged
Data type Integer8 (64 bit signed numeric)
Multivalue (Array) No
System Flags


Search Flags 0x09
In Global Catalog? Yes
Attribute ID 1.2.840.113556.1.2.120
AD DB attribute name USN-Changed
ADSI datatype 10 - LargeInteger
LDAP syntax 1.2.840.113556.1.4.906 - Microsoft Large Integer
Used in ... > W2K
Schema Info Microsoft - MSDN

There is another values which is written when the object is created: uSNCreated.

The value of uSNChanged can only be set by the system - but scripts can read it. Because it's a Large Integer value, we have to handle the uSNChanged attribute in a special way in scripts. These Large Integers are signed numeric values of 8 Byte (64 bit) - those are often called Integer8 values for this reason:

Minimum value:
-9223372036854775808 (-2^63)  or
hex 0x8000000000000000

Maximum value:

9223372036854775807 (2^63 - 1) or

Integer8 values have to be handled as two parts in VB scripts (the HighPart and the LowPart). However, you can combine these parts into one single numeric value as shown in the example:

Set user = GetObject("LDAP://cn=Philipp,ou=USR,dc=ldapexplorer,dc=com")

Set usnRaw = user.Get("uSNChanged")
usnHigh = usnRaw.HighPart
usnLow = usnRaw.LowPart
If (usnLow < 0) Then
     usnHigh = usnHigh + 1
End If
usnValue = (usnHigh * (2 ^ 32)) + usnLow

WScript.Echo "USN Changed: " & usnValue

An LDAP filter which searches all objects which are changed after a certain Update Sequence Number could look like this:


The uSNChanged attribute is required for the technical handling of the incremental Active Directory replication - the domain controller can determine here what changes he has to replicate to other DCs. The USN values are numbers which are incremented by each domain controllers on each change within the entire AD database. The importance of these values is explained in the following videos:

It becomes obvious that each DC carries its own numbering of the vectors and, accordingly, own USN values for all objects and attributes in its database. Is not clear, however, how these values are used to identify those attributes that are actually need to be replicated. But let's look at the last replication operation of the video again in detail: DC2 has just changed the attributes for password and email address. DC1 will now trigger the replication:

To illustrate the internal decision making process for incremental replication even more, we add another detail to this scenario: Replication has not occurred yet between DC1 and DC2, DC2 just made the changes to the the attributes for password and email address. In addition, now an attribute is changed to another DC. The change is known to both of our DCs. How does DC2 now understand that this change must NOT be sent to DC1 in the next replication? Let's look again at another video.

The current global USN value for a domain controller can be examined in the RootDSE entry as an attribute called highestCommitedUSN (the
Screenshot was made with the commercial LDAP Browser LEX):

USN Number in the RootDSE