Re: LDAP queries against A.D.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Torgeir,

Thanks, this is the solution. I assumed it must be someting linke this.
In the MS doc's of the A.D. schema the attribute 'description' is mentioned as:


CN Description
Ldap-Display-Name description
Size -
Update Privilege Domain administrator or account owner.
Update Frequency Whenever the description needs to change.
Attribute-Id 2.5.4.13
System-Id-Guid bf967950-0de6-11d0-a285-00aa003049e2
Syntax String(Unicode) <<<<<<<<<<<<<<<<<<<<<<<<<

I was fooled by that.

Thanks!


Torgeir Bakken (MVP) wrote:
BeauKey wrote:

(snip)

cmdSQL="Select description from 'LDAP://10.0.0.1:389/cn=beaukey,cn=Users,DC=nldomain,DC=nl,DC=ema,DC=ad,DC=acmecorp,DC=com'"

 Set RSObj = conObj.Execute(cmdSQL)

WScript.Echo RSobj.Fields(0).Value
'----------------------------------------------------------

However, when trying to retrieve 'description' I get:

C:\scripts\ldap\ADattribute12.vbs(27, 1) Microsoft VBScript runtime error: Type mismatch

This is the only attribute which cannot retrieved by my script.
What is wrong?

Hi,

The description attribute needs some special treatment:

'--------------------8<----------------------
...
...
Set RSObj = conObj.Execute(cmdSQL)
arrDescription = RSobj.Fields(0).Value

If IsNull(arrDescription) Then
  ' no Description value exists
  strDescription = ""
Else
  For Each strLine In arrDescription
    strDescription = strDescription & strLine
  Next
End If

WScript.Echo strDescription

'--------------------8<----------------------



.



Relevant Pages

  • Re: Include description in userlist from AD
    ... objFile.WriteLine strDN ... For Each strLine In arrDescription strDescription = strDescription & strLine ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.scripting.vbscript)
  • Re: Object.get("description")
    ... For Each strLine In arrDescription ... strDescription = strDescription & strLine ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.scripting.vbscript)
  • Re: Object.get("description")
    ... Dim arrDescription, strDescription, strLine, objUser ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.scripting.vbscript)