use strict; use Net::LDAP; use Net::LDAP::Entry; my $ldap_prov = *servername* print ("\nUsername for connection: "); my $username = ; print ("\nPassword: "); my $password = ; chomp $username; chomp $password; my $ldap = Net::LDAP->new($ldap_prov) || die; my $bind = $ldap->bind($user, password => $password, $version => 3); my $contact = Net::LDAP::Entry->new(); $contact->dn("cn=$contact,cn=contacts,dc=aaa,dc=com); $contact->add(objectclass -> 'contact'); # I'm not sure if you'll need to pass anything else here. Normally when you setup a user, you'll need to also pass the SAMAccountName attribute.... my $result = $contact->update($ldap); $ldap->unbind;