in reply to using Net::LDAP

You are trying to translate code using ADSI (Microsoft's proprietery interface to AD and other services) to LDAP.

LDAP doesn't know the internal NETBIOS representation of your domain name. In LDAP you can't bind to a domain itself have to bind to bind with a specific domain controller by using it's fqdn (hostname may or may not work depending on client's DNS configuration). In addition there is AFAIK no way way to inherit user credentials from logged in user. This is a payoff for using more general interface - magic provided by ADSI is lost.

The code below successfully connects to AD but you need to provide a dc server fqdn, user name and password:

my $ad_ldap = Net::LDAP->new( $ad_ldap_server ) or die ($@); my $ad_mesg = $ad_ldap->bind ( $ad_ldap_user, password => $ad_ldap_pwd +, version =>3, onerror => 'die'); die ( $ad_mesg->error ) if $ad_mesg->code;