Results 1 to 5 of 5

Thread: [SOLVED] Automating user add/remove

  1. #1
    ceefus is offline Active Member
    Join Date
    Sep 2008
    Posts
    29
    Rep Power
    6

    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.

  2. #2
    uxbod's Avatar
    uxbod is offline Moderator
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,016
    Rep Power
    24

  3. #3
    ceefus is offline Active Member
    Join Date
    Sep 2008
    Posts
    29
    Rep Power
    6

    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

  4. #4
    uxbod's Avatar
    uxbod is offline Moderator
    Join Date
    Nov 2006
    Location
    UK
    Posts
    8,016
    Rep Power
    24

    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

  5. #5
    ceefus is offline Active Member
    Join Date
    Sep 2008
    Posts
    29
    Rep Power
    6

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 21
    Last Post: 02-04-2010, 10:06 AM
  2. [SOLVED] Zimbra logwatch.
    By nishith in forum Administrators
    Replies: 5
    Last Post: 06-10-2009, 04:42 PM
  3. Post instsallation problems
    By Assaf in forum Installation
    Replies: 14
    Last Post: 01-29-2007, 11:38 AM
  4. Services stopped working
    By lilwong in forum Administrators
    Replies: 4
    Last Post: 08-15-2006, 09:19 AM
  5. Fedora Core 3, Clean Install - Not working!
    By pcjackson in forum Installation
    Replies: 17
    Last Post: 03-05-2006, 07:38 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
  •