apart from being a programming mess my script is very much tailored to our ldap environment as it pulls user data from there. in the end though it's using the zmprov utility. Here is an example
Code:
zmprov -z ca jdoe@domain.com zimbraCOSid 'a26953c7-f211-4d92-a172-a39591de24bf' givenName 'John' sn 'Doe' displayName 'John Doe'
the cosid can be found by doing
Code:
zmprov gc <cosname> | grep zimbraId