Results 1 to 2 of 2

Thread: how to take a CSV file and turn it into the correct zmprov commands

  1. #1
    Join Date
    Feb 2014
    Rep Power

    Red face how to take a CSV file and turn it into the correct zmprov commands

    I read this wiki, but i still don't understand how to use this script:


    # Lookup the valid COS (Class of Service) ID in the interface or like this
    my $cosid = `su - zimbra -c 'zmprov gc Default |grep zimbraId:'`;
    $cosid =~ s/zimbraId:\s*|\s*$//g;

    while (<>) {

    # CHANGE ME: To the actual fields you use in your CSV file
    my ($email, $password, $first, $last) = split(/\,/, $_, 4);

    my ($uid, $domain) = split(/@/, $email, 2);

    print qq{ca $uid\@$domain $password\n};
    print qq{ma $uid\@$domain zimbraCOSid "$cosid"\n};
    print qq{ma $uid\@$domain givenName "$first"\n};
    print qq{ma $uid\@$domain sn "$last"\n};
    print qq{ma $uid\@$domain cn "$uid"\n};
    print qq{ma $uid\@$domain displayName "$first $last"\n};
    print qq{ma $uid\@$domain zimbraPasswordMustChange TRUE\n};
    print qq{\n};

    how could I could assign my csv file?

    please forgive my poor english , thanks.

  2. #2
    Join Date
    Jan 2013
    Chicago, IL
    Rep Power


    I ended up using a CSV file and importing that into Excel and then writing some equations to generate one long zmprov command that will create our users. That way I can scp the file over to the zimbra server and run zmprov -f FILENAME to generate our users. The script seemed a bit tougher. Our command ends up looking like this:

    createAccount EMAILADDRESS PASSWORD displayName "Their Name" givenName "First Name" sn "Last Name" zimbraCOSId COS_ID zimbraPasswordMustChange TRUE

Similar Threads

  1. Replies: 4
    Last Post: 03-10-2010, 11:22 AM
  2. Replies: 2
    Last Post: 01-17-2010, 11:47 AM
  3. Replies: 2
    Last Post: 10-06-2009, 09:38 PM
  4. [SOLVED] can not find the CLI commands like zmprov
    By Gil Bauman in forum General Questions
    Replies: 1
    Last Post: 05-19-2009, 04:11 AM
  5. zmprov commands?
    By Laird in forum Administrators
    Replies: 1
    Last Post: 08-13-2007, 01:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts