Results 1 to 7 of 7

Thread: [SOLVED] List accounts not in a group

  1. #1
    Join Date
    May 2008
    Location
    California!
    Posts
    226
    Rep Power
    7

    Default [SOLVED] List accounts not in a group

    My forum searches are failing on this one...

    I'm trying to list user accounts on ZCS that are not currently in any group. I'd like it to be narrowed down by domain. I can't see a way to do this in the admin console short of magic. Anyone want to spare some?

  2. #2
    Join Date
    Nov 2007
    Location
    Santa Barbara, CA.
    Posts
    109
    Rep Power
    7

    Default

    Quote Originally Posted by blazeking View Post
    My forum searches are failing on this one...

    I'm trying to list user accounts on ZCS that are not currently in any group. I'd like it to be narrowed down by domain. I can't see a way to do this in the admin console short of magic. Anyone want to spare some?
    Hey blazeking,

    What do you mean by 'group' ? Are you referring to a CoS or perhaps a Distribution List ?

  3. #3
    Join Date
    May 2008
    Location
    California!
    Posts
    226
    Rep Power
    7

    Default

    Distribution List

  4. #4
    Join Date
    Nov 2007
    Location
    Santa Barbara, CA.
    Posts
    109
    Rep Power
    7

    Default

    Quote Originally Posted by blazeking View Post
    Distribution List
    That's what I was afraid of. It's do able but I don't know an easy way of doing it. You see, the data that's inside a user (zmprov ga user@example.org) does not list it's Distribution List membership. Distribution Lists (correct me if I'm wrong) are stored like another user, except they list all the members (via zimbraMailForwardingAddress attribute). So I think to accomplish this, you'd first need to list all the Distribution Lists for a given domain, then look to see if your user belong to any (or not any).

    Let me experiment..

  5. #5
    Join Date
    Nov 2007
    Location
    Santa Barbara, CA.
    Posts
    109
    Rep Power
    7

    Default

    Quote Originally Posted by Jesster View Post
    Let me experiment..
    For whatever reason, I can't seem to get zmprov gdlm user@example.org to work. The Admin Guide (PDF) says the syntax is:

    Code:
    zmprov gdlm {name@domain|id}
    However, I get a no such distribution list error message.
    In other area's of the documentation it says to use:

    Code:
    zmprov gdl {list@domain|id}
    which works when I specify the distribution list (duh) but not the account.
    So, I'm not too sure how to get "gdlm" to work.


    With that said, I produced a horribly inefficient script that gives a crude report. I tested it against Zimbra 5.0.11 with 10 accounts created, 2 Distribution Lists, and 4 of the 10 users belonging to the DL's. The script actually returns the remaining 6 users, plus admin, wiki, ham, and spam accounts. I'm sure you can filter these out.


    YMMV.

    Script prints the users that do not belong to any Distribution List, this is _not_ saved to a file, only to terminal.

    Code:
    
    #!/bin/bash 
    
    mkdir -p ~/tmp
    
    rm -f ~/tmp/all-dl-memberships.txt
    rm -f ~/tmp/all-users.txt
    rm -f ~/tmp/all-users-dls.txt
    
    echo Getting Zimbra Distribution Lists..
    for a in `zmprov gadl`
    do
     echo Processing ${a}
     zmprov gdl ${a} | grep zimbraMailForwardingAddress | sed -e "s/^/${a}: /" | sed -e 's/zimbraMailForwardingAddress://' >> ~/tmp/all-dl-memberships.txt
    done
    
    # Get All Users
    echo Collecting all Zimbra Accounts..
    zmaccts | grep '@' | awk '{print $1}' > ~/tmp/all-users.txt
    
    # Populates File with users & DLs
    echo Creating list of users that are in a Zimbra Distribution List..
    for zimbraUser in `cat ~/tmp/all-users.txt`
    do
      grep " ${zimbraUser}$" ~/tmp/all-dl-memberships.txt >> ~/tmp/all-users-dls.txt
    done
    
    # Let's see what's "diff"erent
    echo Normalizing input and creating diff.. 
    cat ~/tmp/all-users-dls.txt | awk '{print $NF}' > ~/tmp/users-in-a-distribution-list.txt
    echo
    echo
    echo
    echo
    echo "******************************************************"
    echo "Zimbra Users _NOT_ In _ANY_ Distribution Lists Follow:"
    echo "******************************************************"
    echo
    echo
    echo
    diff -Naur ~/tmp/users-in-a-distribution-list.txt ~/tmp/all-users.txt | grep '@' | grep '^\+' | sed -e 's/^+//' | sort
    echo
    echo
    echo
    echo
    echo "******************************************************"
    echo "The End."
    echo "******************************************************"
    echo
    echo
    echo
    
    exit
    Save this to your Zimbra server, chmod +x the file and run it.

    -Jessie

  6. #6
    Join Date
    May 2008
    Location
    California!
    Posts
    226
    Rep Power
    7

    Default

    Thanks!!!

    I had to create the ~tmp folder manually, since the zimbra user did not have permission to do so, but this worked great!

  7. #7
    Join Date
    Nov 2007
    Location
    Santa Barbara, CA.
    Posts
    109
    Rep Power
    7

    Default

    Quote Originally Posted by blazeking View Post
    Thanks!!!

    I had to create the ~tmp folder manually, since the zimbra user did not have permission to do so, but this worked great!
    Glad it worked, sorry about the mkdir thing, I added that at the very end

Similar Threads

  1. Exchange/Imap errors
    By pmibal in forum General Questions
    Replies: 4
    Last Post: 09-23-2009, 11:46 AM
  2. Problem syncing all folders
    By mark_the_chain in forum Error Reports
    Replies: 0
    Last Post: 11-23-2008, 03:59 PM
  3. Compartmentalized groups or locations sharing a domain
    By dstoliker in forum Administrators
    Replies: 5
    Last Post: 07-14-2008, 12:06 PM
  4. [SOLVED] URGENT: Tomcat Not Starting On Reboot
    By AlexanderH in forum Administrators
    Replies: 19
    Last Post: 08-22-2007, 12:42 PM
  5. Group (distribution list) schedule
    By rns in forum Users
    Replies: 1
    Last Post: 03-26-2007, 03:57 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
  •