use Net::LDAP; $ldap = Net::LDAP->new( 'domain.controller' ); # bind to a directory with dn and password # ActiveDirectory does not allow anonymous binds $mesg = $ldap->bind( 'cn=a_valid_user,o=mydomain', password => 'secret' ); $mesg = $ldap->search( # perform a search base => "o=mydomain", filter => "(sAMAccountName=user_name)", attrs => [ "whenCreated" ] ); Net::LDAP::LDIF->new( \*STDOUT,"w" )->write( $mesg->entries );