For Programmers: Free Programming Magazines  


Home > Archive > LDAP > January 2006 > Copying members from one group to another in Active Directory









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Copying members from one group to another in Active Directory
Giuoco, Aaron

2006-01-09, 11:48 pm

Probably a simple answer, but how do you add members to a group with the =
LDAP module?

On a test group, I have tried pushing the contents the member attibute =
of my source group into the member attribute of my destination group, =
but that didn't work. Here is the relevant code:


my $result =3D $ldap->modify($sdEnt->dn(), replace =3D> { 'member' =3D> =
@memberArray });

if ($result->code =3D=3D 0) {
print "Group addition completed successfully.\n";
} else {
print "!!!!!!! Group addition failed !!!!!!!!!\n";
print "ERROR: " . $result->error . "\n";
}


@memberArray is the list that was retrieved from the member attribute of =
the source group. When my script hits this if() statement, it errors =
out with the following message:


!!!!!!! Group addition failed !!!!!!!!!
ERROR: 00000057: LdapErr: DSID-0C090A85, comment: Error in attribute =
conversion operation, data 0, vece


What format is Active Directory expecting for group members? How can I =
transform the list I get from the member attribute to the expected =
format? Thanks!

___________________________
Aaron Giuoco
Assistant Systems Admin
Atlantia Offshore Limited
e: agiuoco@atlantia.com
ph: 281-899-4385
Giuoco, Aaron

2006-01-09, 11:48 pm

Thanks for the response. It turned out to be a brain error. After =
reading the documentation a little more closely, I found my mistake. I =
had to change this line of code:

my $result =3D $ldap->modify($sdEnt->dn(), replace =3D> { 'member' =3D> =
@memberArray });

to this:

my $result =3D $ldap->modify($sdEnt->dn(), add =3D> { 'member' =3D> =
$memberArray });

The value passed needs to be a reference to an array if you are passing =
a list, not an array like I was doing. I also change 'replace' to 'add' =
because that's really what I wanted to do.

AG


> -----Original Message-----
> From: Eric Nichols [mailto:eric@dirwiz.com]
> Sent: Monday, January 02, 2006 2:47 PM
> To: Giuoco, Aaron
> Subject: Re: Copying members from one group to another in Active
> Directory
>=20
>=20
> The member attribute consists of the DN's of the member=20
> objects in the directory.
>=20
> To copy these you need to translate the dn's to the ldap=20
> context of the
> destination server AND those objects MUST exist in the destination.
>=20
> On Mon, January 2, 2006 3:08 pm, Giuoco, Aaron wrote:
> group with the LDAP
> member attibute of my
> group, but that
> 'member' =3D> @memberArray
> attribute of the
> errors out with the
> members? How can I
> expected format?
>=20
>=20

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com