简体   繁体   English

VBScript Active Directory检索属性/属性

[英]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. 到目前为止,我已经完成了一个脚本,该脚本使用很少的LDAP查询枚举了域,配置和架构分区中的所有活动目录对象。 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. 对于每个对象,我都获得其objectClass属性,并通过模式分区中的链接列出了此类对象的必需和可选属性。

The problem happened after that : when I try to do "objLDAP.get(attr)". 之后发生了问题:当我尝试执行“ objLDAP.get(attr)”时。 I got an error message because obviously I try to get an attribute of the objLDAP which is not mandatory set. 我收到一条错误消息,因为显然我尝试获取不是强制设置的objLDAP的属性。 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) 如果不是IsEmpty(objLDAP.get(attr)
  • If objLDAP.contains(attr) 如果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. 我感到很ham愧,发现有一种非常干净便捷的方法可以完成我想要的事情。 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 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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