While you could:
Code:
#!/bin/bash
for i in `zmprov gaa`
do
echo $i
zmprov ga $i | grep zimbraMailAlias
done
Combining gaa -v and grep can be very useful.
This will give you a list like gaa except just of aliases.
Code:
zmprov gaa -v | grep -e zimbraMailAlias | awk '{print$2}' > aliases.txt However I gather you want to know who the aliases belong to:
Code:
zmprov gaa -v | grep -e name -e zimbraMailAlias > allemails.txt
Combining grep and awk can arrange and spit out desired lines in the format of your choosing.
For instance this will put all your accounts in a csv format:
Code:
zmprov gaa | awk 'ORS=","' > accounts.csv
(Don't know what program you're exporting to but if it wants an extra space just do 'ORS=", "')
> location.file needs to be a place that the zimbra user can write to/or browse there first.
Another example
Code:
zmprov getAllAccounts -v |
grep -e name -e zimbraMailAlias |
awk '{
if (/^# name/) {
name=$3
} else if (/^zimbraMailAlias/) {
print $2 ": " name
}
}' Still another:
Code:
#!/bin/bash
SEARCHSTRING="user@domain.tld"
for list in `zmprov gadl`
do
results=`zmprov gdl $list | grep "Address" | cut -d " " -f 2 | grep "$SEARCHSTRING"`
if [ ! -z $results ]
then
echo $list - $results
fi
done By COS, first get the cos id that you want:
zmprov gac -v | grep -e cn: -e zimbraId
or zmprov gc COSname
Then get all accounts with that COS:
zmprov gaa -v | grep -e uid: -e zimbraCOSId | grep -B1 putzimbraCOSidStringHERE | grep uid: | awk '{print $2}'
OR
zmprov gc <COSName> | grep zimbraId
zmprov sa zimbraCOSId=string
or zmprov sa zimbraCOSId=string > file.txt
(viewing-most likely in columns)
Bug 18779 - Sorting User Accounts by COS.
(command line viewing)
Bug 16185 - RFE: Get all COS users
(gui)
Bug 3373 - bulk move of users from one COS to another Bug 14266 - Extend search among users to COS
Admin console - first open the COS and copy where it says "ID: string"
Then type the following in the admin console search bar:
(zimbraCOSID=string)
There's also this bug:
Bug 29763 - Missing zimbraCOSId when set to auto
-create domain.com assign it COS1
-create
test@domain.com cos set to auto > doesn't show zimbraCOSId
-create
test2@domain.com cos set to default > doesn't show zimbraCOSID
-create
test3@domain.com cos set to COS1 > shows zimbraCOSId
-or someone said set the COS on the domain and it works
When creating accounts you should use:
zmprov gc <COSName> | grep zimbraId
zmprov ca
name@domain.com <password> zimbraCOSId <zimbraIdNumberStringCOS>
SA is handy:
Quote:
Originally Posted by mmorse zmprov searchAccounts [-v] {ldap-query} [limit {limit}] [offset {offset}] [sortBy {attr}] [attrs {a1,a2...}] [sortAscending 0|1*] [domain {domain}]
While: Code: zmprov sa -v zimbraCOSId=string | grep uid Gives:
uid: username
And: Code: zmprov sa zimbraCOSId=string Gives: username@domain.com
But for: Code: zmprov sa zimbraCOSId=string attrs uid It still gives you: username@domain.com And should have given:
username Code: zmprov sa -v zimbraCOSId=string attrs uid With -v it's a huge list outputted to the console, however -v is supposed to be used there anyways so that it can dump attributes.
The command was never corrected/closed out as wontfix: Bug 12759 - zmprov searchAccounts does not return requested attrs
-I suppose if it doesn't work (though it would be useful) we should remove the [attrs {a1,a2...}] from the help  |