use Net::LDAP; $userDn = "CN=Ext User 1,OU=External,OU=People,DC=test,DC=com"; $groupDn = "CN=Mailing_All,OU=Mailing Lists,OU=Groups,DC=test,DC=com"; my $ldapConnection = Net::LDAP->new('172.16.171.11', port=>'389') or die "$@"; # Now that we are connected to the directory, bind as the specified user. $mesg = $ldapConnection->bind('administrator@test.com', password => 'password'); # Perform an LDAP search $queryResult = $ldapConnection->search(base=> 'DC=test,DC=com', filter => '(&(objectClass=group))'); $queryResult->code && die $queryResult->error; foreach $entry ($queryResult->entries) { $entry->dump; } print "time to add: " . $userDn . " to group: " . $groupDn . "\n"; my $result = $ldapConnection->modify ($userDn, add => { 'member' => $groupDn }); print "Error code: " . $result->code . "\n"; print "Error name: " . $result->error_name . "\n"; print "Error text: " . $result->error_text . "\n"; $ldapConnection->disconnect; #### Error code: 65 Error name: LDAP_OBJECT_CLASS_VIOLATION Error text: The request specifies a change to an existing entry or the addition of a new entry that does not comply with the servers schema