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
    Posts
    1
    Rep Power
    0

    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:

    #!/usr/bin/perl

    # 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 (<>) {
    chomp;

    # 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
    Location
    Chicago, IL
    Posts
    38
    Rep Power
    2

    Default

    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, 12:22 PM
  2. Replies: 2
    Last Post: 01-17-2010, 12:47 PM
  3. Replies: 2
    Last Post: 10-06-2009, 10: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, 05:11 AM
  5. zmprov commands?
    By Laird in forum Administrators
    Replies: 1
    Last Post: 08-13-2007, 02: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
  •