Quote:
Originally Posted by Jesster 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