PC Review


Reply
Thread Tools Rate Thread

Active directory users and associated groups

 
 
John
Guest
Posts: n/a
 
      14th Mar 2005
Hi, can anyone please tell me (Given a group name) how I can retrieve just
those users associated with that group using Active Directory using LDAP??

I am using the code below with not much luck

Code:
DirectoryEntry entry = new DirectoryEntry("LDAP://" +
Domain,"LoginUser","Password");
DirectorySearcher Dsearch = new DirectorySearcher(entry);
Dsearch.Filter = "objectCategory =All users"; // All users is a group in AD
TIA
Mark


 
Reply With Quote
 
 
 
 
Marc Scheuner [MVP ADSI]
Guest
Posts: n/a
 
      14th Mar 2005
>Hi, can anyone please tell me (Given a group name) how I can retrieve just
>those users associated with that group using Active Directory using LDAP??


You mean retrieve all the users that are MEMBER of that group, right?

Basically, you need to bind to the group, and then insepect the
"member" property

DirectoryEntry deGroup = new DirectoryEntry("LDAP://......");

foreach(string sUserName in deGroup.Properties["member"])
{
Console.WriteLine(sUserName);
}

HTH
Marc

================================================================
Marc Scheuner May The Source Be With You!
Berne, Switzerland m.scheuner -at- inova.ch
 
Reply With Quote
 
John
Guest
Posts: n/a
 
      14th Mar 2005
Thanks Marc, I'll give that a try
Regards
"Marc Scheuner [MVP ADSI]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> >Hi, can anyone please tell me (Given a group name) how I can retrieve

just
> >those users associated with that group using Active Directory using

LDAP??
>
> You mean retrieve all the users that are MEMBER of that group, right?
>
> Basically, you need to bind to the group, and then insepect the
> "member" property
>
> DirectoryEntry deGroup = new DirectoryEntry("LDAP://......");
>
> foreach(string sUserName in deGroup.Properties["member"])
> {
> Console.WriteLine(sUserName);
> }
>
> HTH
> Marc
>
> ================================================================
> Marc Scheuner May The Source Be With You!
> Berne, Switzerland m.scheuner -at- inova.ch



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Active Directory - Domain groups - How to get the names and right of users contains in groups ??? Mathew Microsoft Windows 2000 Security 2 22nd Apr 2005 02:56 AM
Active directory: Get users associated with groups Mark Microsoft Dot NET 3 15th Mar 2005 07:25 AM
Finding Active Directory Groups and Users On a Directory Garrett Microsoft C# .NET 0 30th Nov 2004 06:47 PM
Users and groups Active directory Dancan Microsoft VB .NET 1 13th Sep 2004 02:09 AM
RE: Retrieve Groups/Users from Active Directory in ASP.Net John Wadie Microsoft VB .NET 0 6th Sep 2004 04:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:21 PM.