[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Script for mass updates



Nick Milas wrote:
> Does anyone have a ready-made script (e.g. bash) that would do the following:
> 
>  Loop on all entries in the ou=people branch where ou <> "system" {
>    If attribute DisplayName does not exist{
>       Set DisplayName to the value of attibute cn
>   }
>  }

You could use this LDAP filter to retrieve all entries you have to modify and their 'cn'
attribute:

(&(ou:dn:=people)(!(ou=system))(!(displayName=*)))

Applying this simple LDIF to all the entries found is left as exercise to the reader:

dn: cn=dummy,ou=people,dc=example,dc=com
changetype: modify
add: displayName
displayName: <value taken from 'cn'>

Ciao, Michael.


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature