Greetings,
I want to manage NTLM from the web.
Using WinNT, I query my Active Directory with this:
DirectoryEntry("WinNT://MYDOMAIN")
This returns what appears to be the top level AD object; it's children are
all the other objects in the directory. Such as the "Users" group, and my
own user account.
The problem is, when I want the users in a group:
DirectoryEntry("WinNT://MYDOMAIN/USERS")
The query's children collection (which i hoped would contain the users in
the group) is empty.
So, I changed to using LDAP (even though I do not understand it):
DirectoryEntry("LDAP://MYDOMAIN")
Which returned a single child path of "Builtin." What is Builtin? I don't
know, but I would love some enlightenment.
DirectoryEntry("LDAP://CN=Builtin,DC=MYDOMAIN,DC=com")
This around 8 children, one being:
DirectoryEntry("LDAP://CN=Users,CN=Builtin,DC=MYDOMAIN,DC=com")
I thought this might list all the users in my domain. The assumption
seemed logical as the Users group contains all the users.
However, the children collection remains empty. (as a side note, so did
the CN=Administrators and all the others, I tried them).
I have not successfully used LDAP to list all groups or users. Well, crap -
or anything else for that matter.
Is there no easy way to:
1. list domain users
2. list domain groups
3. list group members
4. add/remove/edit a user
5. add/remove/edit a group
6. add/remove user from a group
???
I would love sample code, but I could use some direction, to.
What's really frustrating is that I can do this in my sleep with COM, and
old-school ADSI.
Moreover, what's the deal with Builtin? No LDAP query will work if I omit
it! Does no one but me have the Builtin nemesis?
I can list all domain groups using WinNT like this:
Dim oEntry As DirectoryEntry = New DirectoryEntry("WinNT://MYDOMAIN")
oEntry.Children.SchemaFilter.Add("group")
dataGrid.dataSource = oEntry.children
I can list all domain users using WinNT like this:
Dim oEntry As DirectoryEntry = New DirectoryEntry("WinNT://MYDOMAIN")
oEntry.Children.SchemaFilter.Add("user")
dataGrid.dataSource = oEntry.children
That doesn't help me list users in a group.
And who even knows how to list what groups a user is a member of?
?Am I going down the wrong path abandoning WinNT for LDAP? Seems like all
the samples out there use LDAP so it /feels/ right, but I am yet to find
the DirectoryServices best practice document. ;-) Or samples that actually
work.
No help from these links (maybe they will help you):
http://www.p2p.wrox.com/archive/c_sharp/2001-12/22.asp
http://www.c-sharpcorner.com/Code/2002/July/UsingAD.asp
http://codetools.com/aspnet/adsi2.asp
http://www.wimdows.net/articles/printme.aspx?aid=13
http://www.dotnet247.com/247reference/msgs/22/112896.aspx
http://www.p2p.wrox.com/archive/c_sharp/2002-06/13.asp
http://www.123aspx.com/resdetail.aspx?res=855
http://samples.gotdotnet.com/quickstart/howto/doc/ADRead.aspx
I am trying to use the DirectoryServices namespace like a good .net
developer but with no useful direction. MSDN/GotDotNet only helps so much.
Hopefully, you have ideas.
Thanks, Jerry