Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra - Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-09-2009, 10:09 AM
Intermediate Member
 
Posts: 16
Default [SOLVED] Automating user add/remove

Hello,

I'm trying to move my company from Exchange to Zimbra. Currently I have about 10 users migrated and everything is working well. The obsticle that I need to overcome is the addition and removal of users. Currently there is a script in place for Exchange that will add/remove a user based on entries from payroll. The script is Tab delimited and has the user, domain (there are 13), employee number, and their status (active,inactive). I need to find a way to take this file and add a user if they're put in active status or remove a user if they're inactive. I also need it to set their password to their employee number and set the domain according to which office they work at..

The file we'll be using looks like this:

User Domain Emp# Status
Jim Smith Office1 123456 Active
Jon Smith Office2 112345 Inactive
Jan Smith Office3 111345 Active

I could also make this file a CSV if needed or manipulate the fields as needed.. I need an idea of how to accomplish this before I can migrate all of the offices....

Any help would be much appreciated!

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 07-10-2009, 01:05 AM
Moderator
 
Posts: 5,806
Default

Zmprov - Zimbra :: Wiki
__________________
SplatNIX IT Services :: Innovation through Collaboration™


http://www.messagefortress.com
Reply With Quote
  #3 (permalink)  
Old 07-10-2009, 10:05 AM
Intermediate Member
 
Posts: 16
Default

Thanks UXBOD, I saw the wiki on zmprov... The problem I have is... I'm not sure how to script it.. I have done some programming but I'm not sure how to get zmprov to roll down the list.. Especially when the list is long, recently we closed an office and let go about 120 people...

The output will be either:

Name,EmployeeNumber,Domain,Status
John Smith,1003001,Green1.com,active
Jane Smith,1004002,Green2.com,active
Jannet Lafferty,1005500,Green3.com,inactive
Jeffery Campbell,1005110,Green3.com,active

Or

Name EmployeeNumber Domain Status
John Smith 1003001 Green1.com active
Jane Smith 1004002 Green2.com active
Jannet Lafferty 1005500 Green3.com inactive
Jeffery Campbell 1005110 Green3.com active
Reply With Quote
  #4 (permalink)  
Old 07-10-2009, 10:10 AM
Moderator
 
Posts: 5,806
Default

Well CSV is always nicer So perhaps something like this
Code:
su - zimbra
while read NAME EMPNO DOMAIN STATUS
do
  case ${STATUS} in
    active) zmprov ca ${NAME}@${DOMAIN} ${EMPNO} displayName ${NAME}
    ;;
    inactive) zmprov da ${NAME}@${DOMAIN} 
    ;;
  esac
done < /tmp/filename.csv
__________________
SplatNIX IT Services :: Innovation through Collaboration™


http://www.messagefortress.com
Reply With Quote
  #5 (permalink)  
Old 07-20-2009, 06:17 AM
Intermediate Member
 
Posts: 16
Default

I have created a fully functional perl script that adds users from a .CSV. If anyone needs it please PM me and I'll get you a copy.

Have a good one
Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0