thank you oeuftete. I was able to get it to work like this:
$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 }
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.
I need it to still add functionals even though they don't have a functional number.

In reply to Re^2: Adding attribut to AD by mr_evans2u
in thread Adding attribut to AD by mr_evans2u

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.