Home: Perl Programming Help: Intermediate:
Connect to LDAP using perl



raoperl
New User

Mar 2, 2011, 5:10 AM


Views: 931
Connect to LDAP using perl

HI All,

I have written a small script for connecting to my activeDirectry.But i m getting below error.Please help me..

000004DC: LdapErr: DSID-0C0906DC, comment: In order to perform this operation a
successful bind must be completed on the connection., data 0, v1db0 at C:\Perl\
LDAP.pl line 9, <DATA> line 522.

my script is :

---------

use Net::LDAP;
$domain="dc=ds,dc=company,dc=net";
$ldap = Net::LDAP->new(vcn.ds.xxxx.net) or die "$@";
$ldap->bind(dn=>$domain,username=>'tin2000x',password=>'xxxxx') or die "$@";
my($mesg) =$ldap->search(base=>$domain,filter=>'(userid=2000)');
$mesg->code && die $mesg->error;
$mesg = $ldap->unbind; # take down session

--------