You might want to check your variable names for consistency - $first vs.
$firstname 

-----Original Message-----
From: John Arends [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 12, 2008 3:53 PM
To: perl-ldap@perl.org
Subject: Re: Help with Active Directory interaction

Now that I'm binding ok, I'm trying to create a user but running into 
additional problems.

I'm running into this error:

failed to add entry: 00000057: LdapErr: DSID-0C090B38, comment: Error in

attribute conversion operation, data 0, vece at ./create.pl line 36.

Thoughts?

#!/usr/bin/perl

use Net::LDAP;
use Unicode::Map8;

my $binduserid = "cn=myuser";
my $bindPass = "supersecretpassword";
my $ldapServer = "ldaps://ad.myorg.edu";


$ldap = Net::LDAP->new ( $ldapServer ) or die "$@";

$ldap->bind($binduserid, password =>$bindPass);

my $firstname = "John";
my $lastname = "Doe";
my $uid = "jdoe1234";
my $password = "123456";
my $fullname = "$firstname $lastname";

my $charmap = Unicode::Map8->new('latin1') or die $!;
my $unipwd = $charmap->tou(qq{"$password"})->byteswap()->utf16();

my $result = $ldap->add (
                dn   => "ou=my guest 
accounts,ou=subou,ou=myou,dc=ad,dc=myorg,dc=edu",
                attr => [ 'objectclass' => 
['user','person','organizationalPerson','top'],
                          'sn'    => $last,
                          'givenName' => $first,
                          'samAccountName' => $uid,
                          'userPrincipalName' => $uid,
                          'displayeName' => $fullname,
                          'unicodePwd'    => $unipwd,
                        ]
              );

$result->code && die "failed to add entry: ", $result->error ;

$ldap->unbind;

Reply via email to