Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

How can i check whether an entry in ActiveDirectory is a User, a SecurityGroup or a DistributionGroup.

Thanks,
Nagendra
Posted

You could try checking the DirectoryEntry.SchemaClassName. Users are indicated with a class name of "User". I don't know what the others are (but you should be able to find them on google).
 
Share this answer
 
Comments
nagendrathecoder 17-Aug-11 8:59am    
Thanks john, that was helpful. Class name for both SecurityGroup and DistributionGroup is "Group". :)
Now i need to evaluate GroupType for the group objects.
Ahh John seems to be on top of it so forget what I said except for my ad :)
AD isn't my strong suit but I beleave you should be able to use the Path poroperty of DirectoryEntry to see if it's a user CN=user should be present, CN=Distribution Groups ect.

I know it's again the rules to post ads but I love this article and it's on subject and on the code project so not an ad. I love this briliant article:
Howto: (Almost) Everything In Active Directory via C#[^]
Edit: Just realized, it could be misinterpreted as it me who wrote the article. I have not written the article the article has been written by thund3rstruck[^]
 
Share this answer
 
v4
Comments
nagendrathecoder 17-Aug-11 9:00am    
Thanks for the link.
I can use GroupType for my purpose.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900