I have a Perl script that adds user accounts to an Active Directory server. The script 
works great until it loops through and tries to add a second user. When it attempts 
the ldap->add on the second user, I get a "LDAP_OPERATIONS_ERROR: Server encountered 
an internal error". My script is grabbing new users from an Informix database and then 
looping through the users found with the SQL and attempting to add them to the Active 
Directory server. I bind and unbind only once, outside the loop. I tried binding and 
unbinding inside the loop with the same error. Has anyone else experienced the 
LDAP_OPERATIONS_ERROR: Server encountered an internal error"? What could be causing it 
in my case? Below is a small piece of my code (the ad_add function does the ldap->add).

$server = ad_connect();
$bind = ad_bind($server);
while (@record = $results->fetchrow())
{
  $msg = ad_add($server,$base,$dn,$record[0],$record[1]);
  if ($msg->code) ##### ERROR Creating LDAP/AD and Email #####
  {
    $message.=Net::LDAP::Util::ldap_error_name($msg->code) . ": ";
    $message.=Net::LDAP::Util::ldap_error_text($msg->code) . "\n";
  } ##### if
} ##### while
$server->unbind();


Dan Swanson
Programmer / Analyst / System Admin
George Fox University
503.554.2576

Reply via email to