One thing I did notice though with this is if their is not a functional number then it just skips over that functional and doesn't create an account at all.$entry = $AD_conn->search($adld{root}, $adld{scope}, "(&(|(employe +eID=$UMF))(mail=*))", 0, @attr); if (!$entry) { my $code = $AD_conn->getErrorCode(); if ($code == 0) { print "No Directory records found to process on this run.\n" } else { print "Run terminated on LDAP Error=" . $AD_conn->getErrorStri +ng() . ".\n"; } } else { while($entry) { print "employeeID mail: $entry->{mail}[0],\n"; my $ID = $entry->{mail}[0]; # Create the new Directory entry # $entry = new Mozilla::LDAP::Entry; $entry->setDN(("cn=$CN,OU=FunctionalContacts,OU=Functional,OU=Exch +ange,OU=Services,") . $adld{root}); $entry->addValue("objectclass", "top"); $entry->addValue("objectclass", "organizationalPerson"); $entry->addValue("objectclass", "person"); $entry->addValue("objectclass", "contact"); $entry->addValue("description", "POC:$ID"); # Put the remaining values into the AD Directory $fa_values{"mailnickname"} = $username; while (($attr,$value) = each %fa_values) { $entry->addValue($attr, $value); } $AD_conn->add($entry); if ($AD_conn->getErrorCode()) { print "FAILED create_record:$entry->{mailNickname}[0] because '" . + $AD_conn->getErrorString() . "'\n\n"; } else { print "Created mailNickname:$entry->{mailNickname}[0]\n"; } $entry = $AD_conn->nextEntry(); } # End of while loop }
In reply to Re^2: Adding attribut to AD
by mr_evans2u
in thread Adding attribut to AD
by mr_evans2u
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |