Add mass users and groups

From Zarafa wiki

Revision as of 07:50, 14 March 2012 by Dominique PERESSONI (Talk | contribs)
Jump to: navigation, search

Add mass users Script

The followings script and CSV file sample will help you create hundreds of users and their respective stores to Zarafa, using only ONE command line.
This script can be easily customized in order to match to your needs, by adding zarafa-admin command options (ex : a or n options)
Tested release : Zarafa 7.x.x
Note : before using this script, make sure Zarafa settings are correct, and will create automatically user stores in the desired language.
Additional note : This script has been designed for DB Plugin only

The script:

#!/bin/bash
while read line
do
set $(echo $line)
user=$(eval echo $1)
firstname=$(eval echo $2)
lastname=$(eval echo $3)
pass=$(eval echo $4)
zarafa-admin -c "$user" -e "$user@mydomain.tld" -f "$firstname $lastname" -p "$pass"
done < userlist.csv

The CSV sample:

user1.login1		Firstname1 Lastname1		password1
userlogin2		Firstname2 Lastname2		password2
ulogin3			Firstname3 Lastname3		password3
uptoyoulogin4		Firstname4 Lastname4		password4

Add users to Group Script

You already created Zarafa users, with the following script and CSV file sample you will able to add them to Zarafa Groups, and once again, using only ONE command line.
Tested release : Zarafa 7.x.x
Note : This script has been designed for DB Plugin only

The script:

#!/bin/bash
while read line
do
set $(echo $line)
user=$(eval echo $1)
zarafa-admin -b "$user" -i Group1
done < group1.csv

The CSV sample:

user1.login1
userlogin2
ulogin3
uptoyoulogin4
Personal tools