If you are going to use that type of path syntax that uses the full DN, you
have to know the actual DN of the group. Guessing won't help. It is
generally a better idea to find the group via a search first and then once
you've found it, you find the full path from that.
You might be better served using the
System.DirectoryServices.AccountManagement namespace in .NET 3.5. You can
easily find objects by known identifiers like their names and then use the
API to enumerate the members of the group very easily. Having strongly typed
objects for things like GroupPrincipal makes this much easier than with
S.DS. You end up needing to know much less about how the directory works and
is laid out.
--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
"John Peterson" <> wrote in message
news:. ..
>I am trying to use LDAP to list the members of a domain local group.
> MSDN has an example:
> http://msdn.microsoft.com/en-us/libr...8VS.80%29.aspx
>
> I have converted the C# example to VB.NET. When I use VB.NET 2005 and
> try to run the example I get the error "There is no such object on the
> server.". If I look at the returned object "objgroup",(while in the
> debugger) it appears to not contain any data. I have tried several
> different LDAP queries shown below and get the same results. Can someone
> tell me what I am doing wrong?
>
> Dim objgroup As DirectoryEntry = New DirectoryEntry
> ("LDAP://borg2.chem.xxx.edu/CN=grpUGSShareReadWrite,DC=chem,DC=xxx,DC=ed
> u", <username>, <password>, AuthenticationTypes.Secure)
>
> For Each dn As Object In objgroup.Properties("member")
> MsgBox("Value = " & dn)
> Next
>
> Where "grpUGSShareReadWrite" is the name of the group. The group is
> located in a nested OU ChemDepartment->ChemUsers. I have also tried the
> following LDAP string:
>
> LDAP://borg2.chem.xxx.edu/CN=grpUGSShareReadWrite,OU=ChemDepartment,OU=C
> hemUsers,DC=chem,DC=xxx,DC=edu
>
> The username and password I am using is a normal user that is a member
> of the group. I have also tried using the administrator password. The
> server is a Windows 2003 Server. I am running the LDAP code on a Windows
> XP computer.
> Thank you.
>
> John
>