Add ActiveDirectory user to Global Security Group

K

killbill

Hi All,

I am struggling with a problem, i want to add ActiveDirectory user to
Global Security Group using C# and DirectoryServices. Any suggestiion
???

Thanks.
 
M

Marc Scheuner

I am struggling with a problem, i want to add ActiveDirectory user to
Global Security Group using C# and DirectoryServices. Any suggestiion

1) Bind to the group in question.

DirectoryEntry group = new
DirectoryEntry("LDAP://cn=MyGroup,ou=SomeOU,dc=company,dc=com");

2) Call the .Add method on the "member" property of the group,
specifying the user to add with its distinguishedName

group.Properties["member"].Add("cn=Joe
User,ou=Research,ou=HQ,dc=company,dc=com");

3) Call .CommitChanges on the group to commit the changes to the store

group.CommitChanges();


Done!

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top