Results 1 to 7 of 7

Thread: zmprov: Get All Accounts With ATTR=X?

  1. #1
    Join Date
    Sep 2006
    Location
    Illinois
    Posts
    374
    Rep Power
    9

    Default zmprov: Get All Accounts With ATTR=X?

    Anyone know the command for this?

    I'm trying to find all users in a particular COS. I know these don't work...

    Code:
    zmprov gaa zimbraCOSId theCOS
    zmprov ga zimbraCOSId theCOS
    Matt

  2. #2
    Join Date
    Oct 2007
    Location
    North East England
    Posts
    167
    Rep Power
    8

    Default

    Hi Matt

    I think this post should help.
    Craig Rodway » Flickr | Last.fm | Del.icio.us | Twitter

  3. #3
    Join Date
    May 2006
    Location
    USA
    Posts
    6,242
    Rep Power
    21

    Default

    If you have a large number of users zmprov gaa -v is painful, a faster way to find those in a COS:
    zmprov gc default | grep Id
    zmprov sa zimbraCOSId=string

  4. #4
    Join Date
    May 2006
    Location
    USA
    Posts
    6,242
    Rep Power
    21

    Default

    Ok so on the speed front some may say it's a minimal advantage, as it's simply not printing all the account info to screen or saving to a file.

    (For appearances zmprov sa -v searchValue essentially does the same as zmprov gaa -v | grep something.)

    If you have thousands of accounts though that's a big difference, plus it's faster to type, and easier to remember than:
    zmprov gaa -v | grep -e uid: -e zimbraCOSId | grep -B1 putzimbraCOSidStringHERE | grep uid: | awk '{print $2}'
    Remember zmprov gaa -v | grep zimbraCOSId just would get a bunch of numbers back, you need the usernames so you have to rearange - searchAccounts is much smoother in spitting out addresses.

    searchAccounts usage : [-v] {ldap-query} [limit {limit}] [offset {offset}] [sortBy {attr}] [attrs {a1,a2...}] [sortAscending 0|1*] [domain {domain}]


    ---

    So the best route to find all users in a COS:
    Code:
     zmprov getCos COSname | grep Id
    (actually gives you zimbraId but you type zimbraCOSId in the next line)
    Code:
     zmprov searchAccounts zimbraCOSId=stringFromZimbraId
    And you'll get back:
    user@domain.com
    user2@domain.com
    Last edited by mmorse; 05-27-2008 at 11:30 AM. Reason: in short, 2nd edit: usage values

  5. #5
    Join Date
    Sep 2006
    Location
    Illinois
    Posts
    374
    Rep Power
    9

    Default

    Doh!...nevermind...remove the '-v' dummy.

    Awesome....thanks Mike...I knew there was a way to do that... I forgot about the searchAccount command.

    So I can get this to work...
    Code:
    zmprov sa -v zimbraCOSId=5487b59c-de80-4220-a819-07a6a84ed122 | grep uid
    But not this...what am I doing wrong with the "attrs" option?
    Code:
    zmprov sa -v zimbraCOSId=5487b59c-de80-4220-a819-07a6a84ed122 attrs uid
    Matt
    Last edited by Chewie71; 05-27-2008 at 08:55 AM. Reason: I'm a dummy

  6. #6
    Join Date
    May 2006
    Location
    USA
    Posts
    6,242
    Rep Power
    21

    Default

    Quote Originally Posted by Chewie71 View Post
    Doh!...nevermind...remove the '-v' dummy.
    My copy/paste didn't work above - usage:
    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 -v zimbraCOSId=string
    Gives:
    username@domain.com

    But for:
    Code:
    zmprov sa zimbraCOSId=string attrs uid
    With -v it's a huge list, however -v is supposed to be used there so that it can dump attributes.

    But with attrs uid it still gives you:
    username@domain.com

    And should have given:
    username

    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

  7. #7
    Join Date
    Oct 2008
    Location
    Thailand
    Posts
    65
    Rep Power
    6

    Default I run your command but I don't get anything

    I run this command

    #zmprov gc default | grep Id
    output :
    zimbraFeatureIdentitiesEnabled: TRUE
    zimbraId: e00428a1-0c00-11d9-836a-000d93afea2a
    zimbraIdentityMaxNumEntries: 20
    zimbraMailIdleSessionTimeout: 0
    ...

    so I run next command like this

    # zmprov sa zimbraCOSId=e00428a1-0c00-11d9-836a-000d93afea2a

    I don't get anything ,I don't know why

    Please tell me

Similar Threads

  1. Rare characters creating accounts from zmprov ca
    By spAlex in forum Administrators
    Replies: 0
    Last Post: 09-11-2007, 02:31 AM
  2. Replies: 6
    Last Post: 06-21-2007, 02:46 PM
  3. Replies: 9
    Last Post: 04-14-2007, 08:31 AM
  4. Alias Problems
    By Netsample in forum Administrators
    Replies: 8
    Last Post: 03-23-2007, 02:10 AM
  5. Migrating accounts with zmprov
    By Alfspace in forum Administrators
    Replies: 2
    Last Post: 10-19-2005, 10:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •