What would be the best way to find all of the accounts on a server which are using a specific COS. This would be very helpful for COS migration to make sure you aren't going to be removing a COS that is in use.
Peter
What would be the best way to find all of the accounts on a server which are using a specific COS. This would be very helpful for COS migration to make sure you aren't going to be removing a COS that is in use.
Peter
You'll need to ssh into the server and su as zimbra:
-This will list all COS's and get their ID.
zmprov gac -v | grep -e cn: -e zimbraId
-This will get all accounts from a specific COS.
zmprov gaa -v | grep -e uid: -e zimbraCOSId | grep -B1 %zimbraCOSId% | grep uid: | awk '{print $2}'
Replace %zimbraCOSId% with the actual value of the COS ID you want.
If you want to go a step further and add a domain name to the end of each user ID, then change "awk '{print $2}'" to "awk '{print $2"@domain.com"}' or just grep for "# name" instead of uid: and print $3 from awk.
-Heck send it out to a text file too:
zmprov gaa -v | grep -e uid: -e zimbraCOSId | grep -B1 %zimbraCOSId% | grep uid: | awk '{print $2}' > /tmp/filename.txt
Thank you very much.
If I have the free time, I'll try to put this into an interactive bash script and post it for others to use
Thanks again,
Peter
'zmaccts' is also handy-does a quick sort by domain
this wiki doc is what you probably originally needed:
Zmprov - ZimbraWiki
-Mike Morse (MCode151)
ZCS-to-ZCS Migrations & Moves | Admin Tools & Tidbits » ZimbraBlog.com | ZimbraCommunity.com
zmaccts is a little pearl and I was quite happy when I found it, but no built in zm command does really what I need to do which was to sort out Class of Service usage. This is probably not something that most people are going to want to do often so I can understand the lack of a built in tool. It's most useful for accounting purposes (who's using what) and for migration purposes (before I delete a COS, who is using it?).
I use zmaccts quite often, and it is a wonderful tool to help find stale accounts. Is it only supposed to run on Zimbra LDAP servers, though? Just curious. I get an error when I try to run it when ssh'd into a mailstore.
Odd that on my search for more zmaccts info I end up back at my old post.
So I have a situation where if I run
'zmaccts | grep domain.com' | wc -l
I get 90 accounts (91 line minus the summary line), but if I do
'zmprov gaa | grep domain.com | wc -l'
I get 92 accounts. I can't figure out why I see the two accounts that aren't in the zmaccts report and I can't figure out what is special about them so that they fail to show up.
EDIT: The accounts missing have periods in the username. Perhaps that's the problem. There might be a bug in the perl script.
There are currently 1 users browsing this thread. (0 members and 1 guests)