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 Search this Thread Display Modes
  #1 (permalink)  
Old 12-04-2008, 12:07 PM
Advanced Member
 
Posts: 204
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?
Reply With Quote
  #2 (permalink)  
Old 12-04-2008, 12:23 PM
Trained Alumni
 
Posts: 108
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 ?
Reply With Quote
  #3 (permalink)  
Old 12-04-2008, 12:30 PM
Advanced Member
 
Posts: 204
Default

Distribution List
Reply With Quote
  #4 (permalink)  
Old 12-04-2008, 12:50 PM
Trained Alumni
 
Posts: 108
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..
Reply With Quote
  #5 (permalink)  
Old 12-04-2008, 02:02 PM
Trained Alumni
 
Posts: 108
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
Reply With Quote
  #6 (permalink)  
Old 12-04-2008, 02:25 PM
Advanced Member
 
Posts: 204
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!
Reply With Quote
  #7 (permalink)  
Old 12-04-2008, 02:30 PM
Trained Alumni
 
Posts: 108
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.