Reading users and user groups

  • Thread starter Thread starter Bjorn Kristensen
  • Start date Start date
B

Bjorn Kristensen

Hi.

I'm trying to read all the users and user groups from the NT domain I'm
connected to.
I cnat't se how this should be done. Can anyone help me.

I'm basically trying to link my users to the domain user's! I'll keep track
of my applications
user rigts but with the NT Domain users..

Thanks

Bjorn.
 
Use the DirectoryServices namespace with the WinNT provider for NT4.0
domain, and LDAP for Win2K domain with Active Directory.

DirectoryEntry objDomain = new DirectoryEntry("WinNT://domain")
foreach(DirectoryEntry objChild in objDomain.Children) {
if(objChild.SchemaClassName == "user") {
// This is a user
}
}

Or something like that for NT 4.0 (not tested or compiled). For Win2K use
the LDAP://rootDSE to get the name of the domain naming context and use the
DirectorySearcher class to find all users.


Arild
 
Back
Top