473,320 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Get all members of a SecurityGroup in AD?

Hi

I've been informed that it is very troublesome to retrive all members in a domain (let's say "ABC"), that is member of a specific SecurityGroup (global or local)? I've been told that one has to loop through every single user in the domain and then ask "Is he member of the securitygroup"? Can this really be true?

What's the best way to retrieve information on who is member of e.g. SecurityGroup "ABC.SecGrp1"?

Thanks!
/Claus
Nov 17 '05 #1
1 1513
"Claus Konrad" <so*@meal.it> wrote in message
news:Ob*************@TK2MSFTNGP09.phx.gbl...
What's the best way to retrieve information on who is member of e.g.
SecurityGroup "ABC.SecGrp1"?


There are several ways to do this. I'd suggest posting your message on
microsoft.public.adsi.general where you can take anything Joe Kaplan says as
pretty much definitive... :-)

In the meantime, here's a function which accepts the group as a parameter
and returns a Hashtable of the members of that group:

using System;
using System.Collections;
using System.DirectoryServices;

public static Hashtable GetUsersInGroup(string pstrGroup)
{
DirectoryEntry objADEntry = null;
DirectoryEntry objGroup = null;
object objMembers = null;
Hashtable htblUsers = new Hashtable();

try
{
objADEntry = new DirectoryEntry("WinNT://" + mstrDomain + ",
domain");
objGroup = objADEntry.Children.Find(pstrGroup, "group");
objMembers = objGroup.Invoke("Members");
foreach (object objMember in (IEnumerable)objMembers)
{
DirectoryEntry objUser = new DirectoryEntry(objMember);
htblUsers.Add(objUser.Name, GetObjectProperty(objUser.Name,
"FullName"));
}
return htblUsers;
}
catch (Exception)
{
throw;
}
}
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Carlos Ribeiro | last post by:
I thought about this problem over the weekend, after long hours of hacking some metaclasses to allow me to express some real case data structures as Python classes. I think that this is something...
8
by: CoolPint | last post by:
I read in books that nested class cannot access private members of nesting class and vice versa unless they are made friends. Somehow, my compiler is letting my nested class member functions access...
3
by: DanielBradley | last post by:
Hello all, I have recently been porting code from Linux to cygwin and came across a problem with static const class members (discussed below). I am seeking to determine whether I am programming...
5
by: radek jedrasiak | last post by:
Hi all, this is about an idea for a language feature. Any feedback welcome. To start with: This is about a language feature, which would allow to filter the set of available members of a...
2
by: Dave Veeneman | last post by:
Is is legal to declare abstract members in non-abstract classes? How about non-abstract members in abstract classes? I am writing a base class with three derived classes. The base class will...
5
by: Genboy | last post by:
My "VIS" Website, which is a C# site created in VS.NET, Framework 1.1, is no longer compiling for me via the command line. As I have done 600 times in the last year and a half, I can compile to...
10
by: Abelardo Vacca | last post by:
Hi, The title sums up the question pretty much. I would like to access all private members of a class including the private members of its base classes.( I already have the ReflectionPermission )...
11
by: Kevin Prichard | last post by:
Hi all, I've recently been following the object-oriented techiques discussed here and have been testing them for use in a web application. There is problem that I'd like to discuss with you...
14
by: lovecreatesbea... | last post by:
Could you tell me how many class members the C++ language synthesizes for a class type? Which members in a class aren't derived from parent classes? I have read the book The C++ Programming...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.