Check if AD attribute exists RRS feed

  • Question

  • I want to write a vbscript that copies parts of my Active Directory in a SQL database. I start with a dictionary and add all attributes I want to read from LDAP in that dictionary. In the next step I loop through the dictionary and try to read the attributes from the AD. This is the reason I have to read it (as example) with GetEx("givenName") instead of reading it by objuser.givenName, because I have to replace givenName with a variable.

    But if an attribute doesn't exists at one user I get an error 8000500D (The directory property cannot be found in the cache). Is there any way to check if an attribute property exists?

    • Moved by Bill_Stewart Monday, March 12, 2018 8:17 PM This is not "scripts on demand"
    Thursday, January 18, 2018 5:01 PM

All replies

  • Use PowerSHell. 

    You have to catch the error and take steps.

    You can connect SQLServer to AD using a linked server and the AD OLEDB provider.  Post in SQLServer forum to learn how.


    Thursday, January 18, 2018 5:49 PM