How to list members in distribution lists
A script to list users in every distribution list in the system, showing the results by distribution list, as in this example.
======= GROUP: dist1 =============
user1 ezy, [email protected]
user3 ezy, [email protected]
user5 ezy, [email protected]
======= GROUP: allgroup =============
administrator, [email protected]
Peerapach, [email protected]
======= GROUP: dist2 =============
euro1, [email protected]
euro2, [email protected]
Script to list users in every distribution list in the system
#!/bin/bash
for DIST in `zmprov gadl`
do
DISTNAME=`echo ${DIST} |cut -f1 -d@ `
echo " ======= GROUP: ${DISTNAME} ============="
for LISTNAME in `zmprov gdlm ${DIST}|egrep -v "#|member|^$|galsync"`
do
ALL=`zmprov -l ga ${LISTNAME}`
echo "$ALL" > /tmp/ondetail.txt
DISPLAYNAME=`grep -i "displayName:" /tmp/ondetail.txt |awk '{ print $2 }'`
echo ${DISPLAYNAME}, ${LISTNAME}
done
done