On 3/8/05 8:16, Chris Heath <[EMAIL PROTECTED]> wrote:
> I am trying to use Net::LDAP to manipulate AD. I can find, modify, & delete
> entries but have trouble creating them. All the examples that I have found
> online use Win32::OLE. How can I do this with Net::LDAP? Here is the code
> that I am using:
>
> my $ADS_UF_NORMAL_ACCOUNT = 512;
> my $entry = Net::LDAP::Entry->new;
> $entry->dn("CN=test_create,CN=Users,DC=usadir,DC=usa,DC=usouthal,DC=edu");
> $entry->add(
> 'cn' => 'test_create',
> 'sAMAccountName' => 'test_create',
> 'userAccountControl' => $ADS_UF_NORMAL_ACCOUNT,
> 'givenName' => 'john',
> 'sn' => 'test_create',
> 'displayName' => 'john test_create',
> 'userPrincipalName' => '[EMAIL PROTECTED]',
> 'userPassword' => '99RedBal',
> );
> my $results = $entry->update( $ldap );
> $results->code &&
> die "create failed:" . $results->error ;
>
> This is the error I get when I run it:
>
> create failed:0000207B: UpdErr: DSID-03050FB6, problem 6002
> (OBJ_CLASS_VIOLATION), data 0
Well, you're not setting *any* values for the mandatory objectClass
attribute, so this error seems reasonable.
AD's got an extremely broken and non-standard schema, so I've no idea what
object classes AD might be expecting. If you read an entry which you think
is like the thing you're trying to create, it might give a clue :-)
> Also, what are some good online resources for the AD/perl combination?
>
> Thanks in advance for any help,
Cheers,
Chris