April 13, 2010

How to get an attribute not in the ADSI property cache ?

To reduce network traffic ADSI implement a property cache for Active Directory Objects. When an ADSI object is instantiated (created), the cache is populated with object’s attributes stored in Active Directory.

To reduce the amount of data managed by the cache only the most frequently used attributes are kept in the cache. If you want to retrieve an attribute (property) that is not in the cache, let say for example the canonicalName of the domain (mydomain.com) you have to call the RefreshCache  method like this :

$root=[ADSI]""
$root.RefreshCache(@("canonicalName"))
$Root.get("canonicalName")

No comments:

Post a Comment