Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning 'description' of group from AD

Status
Not open for further replies.

cottonpants

Technical User
May 27, 2003
67
0
0
CA
Hi - I have no hair left and am turning to you for help.

I am running an LDAP query to return all the members of all my groups in AD. Some groups have a description, some don't.

If I add 'description' to my attribute list to return, I only get groups that have a description. If I remove the attribute, I get all of them.

Under no circumstance have I been able to actual write out the description.

Here's my code - see anything glaringly wrong???
ADSIQueryText = "<LDAP://" & ADSINamingNC & ">;(&(objectCategory=group)(groupType:1.2.840.113556.1.4.803:=2147483656));name,distinguishedName,description;subtree"

and then...

Output.WriteLine ADSIResult.Fields("distinguishedName").Value & CHR(9) & ADSIResult.Fields("name").Value & CHR(9) & ADSIResult.Fields("description")

is there something weird about the description field that I don't know about?
I have also tried
'if isnull(ADSIResult.Fields("description"))' and
'if len(ADSIResult.Fields("description")) = 0 '

logic to see if it makes a diffence but sadly not...

thanks in advance if you can help
 
found the answer...

apparently the 'group' attribute is a multiple value type attribute (similar to 'member' and 'member of') although it can only have 1 value. Go figure.

So in order to get the value you need to use the GetEx command and look at the first element in the array

e.g.
arrTest = GetStuff.GetEx("description")
strDescription = arrTest(0)

ta da
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top