[Samba] Create OU with address details

Rowland penny rpenny at samba.org
Sat Jan 11 15:21:38 UTC 2020

On 11/01/2020 14:47, Afshan Suheel via samba wrote:
> Hi,
> using below code to create ou:
> try:
>              full_ou_dn = samdb.normalize_dn_in_domain(ou_dn)
>          except Exception as e:
>              raise CommandError('Invalid ou_dn "%s": %s' % (ou_dn, e))
>          try:
>              samdb.create_ou(full_ou_dn, description=description)
>          except Exception as e:
>              raise CommandError('Failed to create ou "%s"' % full_ou_dn, e)
> Using this code I'm  able to add only ou name and description.
And that is all the code will allow :-(
> How to add/update ou address details like city, state and zip code etc.

You could write a script around the 'samba-tool ou create' command to 
create the OU and then, using an ldif, add your required attributes.


More information about the samba mailing list