From: Clif H. <cl...@di...> - 2001-03-30 21:37:11
|
> > I am getting the following error and the code is below that (note this is > from a Linux box with Perl 5.6.0) > > pulsar(4)>perl create.pl > add failed: Net::LDAP::Add=HASH(0x82d7148)->error at create.pl line 31. > pulsar(5)> > > 1 #!/umr/testbin/perl > 2 > 3 $| =1; > 4 > 5 > 6 use Net::LDAPS; > 7 $ldaps = new Net::LDAPS('srvtst01.cc.umr.edu', > 8 port=> '636'); > 9 > 10 > 11 $UserPass="94ranger"; > 12 $UserID="Administrator"; > 13 $ADSserver='srvtst01.cc.umr.edu'; > 14 $DomainDN=" dc=test, dc=umr, dc=edu"; > 15 $UserDN="cn=$UserID, cn=users, " . $DomainDN; > 16 > 17 $ldaps = Net::LDAPS->new($ADSserver) || die "failed: $@"; > 18 > 19 $mesg = $ldaps->bind( dn =>"$UserDN", password => "$UserPass" ); > 20 $mesg->code && die "bind failed: $mesg->error"; > 21 > 22 $tempDN = "cn=Test Edgington, cn=Users, " . $DomainDN; > 23 > 24 $mesg = $ldaps->add( > 25 dn => 'cn=Users, dc=test, dc=umr, dc=edu', > 26 attr => [ samAccountName => 'test2', > 27 displayName => 'Test2 Edg', > 28 userPrincipalName => 'te...@te...' > 29 ] > 30 ); I am no expert on Active Directory but I do not see anything about the objectClass definitions in the attr section. I would think that it would at least need the following; objectClass => [ "top ", "person ", "organizationalPerson ", "user"] Regards, Clif > 31 $mesg->code && die "add failed: $mesg->error"; > 32 > 33 > 34 > 35 > > thanks. > > > > > -----Original Message----- > From: Behruz Rushenas [mailto:beh...@cp...] > Sent: Friday, March 30, 2001 1:23 PM > To: J Beck; 'Edgington, Jeffrey'; per...@li... > Subject: RE: Creating a user in Win2K AD via Net::LDAP > > > Make sure you are using the right object classes and the mandatory > attributes you need to create a user in AD. > Try this to create a mail-enabled user in ActiveDirectory. > > userAccountControl = 512 > cn = John Smith > givenName= John > mailNickname =Smith > sAMAccountName =Smith > sn=Smith > userPrincipalName =Smith > objectclass=top;person;organizationalPerson;user;securityPrincipal;mailRecip > ient > > > You can even try first to add a entry by using the "ldapmodify" utility to > make sure you can create this entry whithin the directory before starting to > add it through a program. > > Behruz. > > > > -----Original Message----- > From: per...@li... > [mailto:per...@li...]On Behalf Of J Beck > Sent: Friday, March 30, 2001 10:54 AM > To: 'Edgington, Jeffrey'; per...@li... > Subject: RE: Creating a user in Win2K AD via Net::LDAP > > > you might want to look at your directory's logs. > what kinds of errors are your getting. > it could be permissions, a replicated branch, a required objectclass being > left out... > > > -----Original Message----- > From: per...@li... > [mailto:per...@li...]On Behalf Of > Edgington, Jeffrey > Sent: Friday, March 30, 2001 11:52 AM > To: per...@li... > Subject: Creating a user in Win2K AD via Net::LDAP > > > I'm trying to create userid's in Win2K AD via Net::LDAP with little > success.... I can manipulate current accounts, but can't create them.... has > anyone else been successful with this?... and if so, would you care to share > what you did? > > Thanks. > > jeff e. > > > > |