centem
asked on
Adding to AD group with ASP and AccountManagement namespace
Greetings,
I wan to use the following code as a template to add user to a particular group in AD. The problem I'm encountering is how to add to an OU group that has the same name as others. For example, Users in Miami in Florida in US versus Users in Madrid in Spain. Thanks.
GroupPrincipal grp = GroupPrincipal.FindByIdent ity(ctx,
IdentityType.Name,
"Domain Admins");
if (grp != null)
{
grp.Members.Remove(ctx, IdentityType.Name, "John Smith");
grp.Members.Add(ctx, IdentityType.Name, "Jim Daly");
grp.Save();
grp.Dispose();
}
ctx.Dispose();
I wan to use the following code as a template to add user to a particular group in AD. The problem I'm encountering is how to add to an OU group that has the same name as others. For example, Users in Miami in Florida in US versus Users in Madrid in Spain. Thanks.
GroupPrincipal grp = GroupPrincipal.FindByIdent
IdentityType.Name,
"Domain Admins");
if (grp != null)
{
grp.Members.Remove(ctx, IdentityType.Name, "John Smith");
grp.Members.Add(ctx, IdentityType.Name, "Jim Daly");
grp.Save();
grp.Dispose();
}
ctx.Dispose();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad it made sense to you, reads like gobbeldygook to me.
ASKER
Not just helpful but also educational. Value added info.
ASKER