简体   繁体   中英

VBScript Active Directory Retrieve attributes/properties

As I said, I would like to know if there is a way to retrieve all attributes/properties of an active directory object. I keep seeing ways to retrieve attributes for a user, a computer or else but I'm looking for a single clean way do to that. I don't want to get specific attributes but all of them.

By now, I've done a script which enumerates all active directory objects from the domain, configuration and schema partition with few LDAP query. For each object, I get its objectClass property and, with a link in the schema partition, lists mandatory and optional attributes for this kind of object.

The problem happened after that : when I try to do "objLDAP.get(attr)". I got an error message because obviously I try to get an attribute of the objLDAP which is not mandatory set. I mean, this object can have the attribute but this last one is not necessarily set.

Somes say to test if the property exists before get it, or if the object contains the property but I tried the following :

  • If Not IsEmpty(objLDAP.get(attr)
  • If objLDAP.contains(attr)

and it didn't worked. The first one give me the "The directory property cannot be found in the cache" error message. The second one says that this method is not supported.

So I'm available to everybody who would like to help, by fixing this problem or just if someone know how to lists an all active directory with object attributes in an other way than my process.

Juste to say that my problem was solved. I'm ashamed to found out that there was a very clean and easy way to do what I wanted. Here it is :

 For I = 0 To objLDAP.PropertyCount-1
       Set pAttr = objLDAP.Item(I)
       <do some stuff here>
 Next

So I hope that nobody spent its time trying to solve my problem.

Thank you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM