Results 1 to 8 of 8

Thread: Bulk Remove domain aliases

Hybrid View

  1. #1
    Join Date
    Jun 2006
    Posts
    72
    Rep Power
    9

    Question Bulk Remove domain aliases

    I have a domain expiring and have a large number of users with it setup as an alias. Zimbra won't let me remove the domain without removing each alias pointing to it first, is there a way to automate this process? I really don'twant to have to sort through all of my users to determine which ones have this set up as an alias... Is there any reason I can't search on the domain and get a list of emails/aliases for that particular domain? I'm working on a script for it now, but i'm not sure how well it will work out. If there's an easier/quicker way feel free to let me know.

    Thanks,
    Kyle

  2. #2
    Join Date
    Jun 2006
    Posts
    72
    Rep Power
    9

    Default

    Think I've found a solution, I'll post the code once i've confirmed it's working properly.

    Thanks,
    Kyle

  3. #3
    phoenix is offline Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,587
    Rep Power
    58

    Default

    Quote Originally Posted by kechols
    Think I've found a solution, I'll post the code once i've confirmed it's working properly.
    If it works could you enter it in the wiki for future users?
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

  4. #4
    Join Date
    Jun 2006
    Posts
    72
    Rep Power
    9

    Talking

    No problem.

  5. #5
    Join Date
    Jun 2006
    Posts
    72
    Rep Power
    9

    Wink I got it working somewhat......

    It got all but 2 aliased accounts for me. I can post it here for you for now, and once i've refined it a little (probably over the weekend or next week) post a nice "I know this'll work version". The only problem I have with it is you HAVE to run this code as eith root or zimbra either way it will sudo -u zimbra for parts that require zimbra user do the work. It's ugly, but works.

    I've also discovered " zmprov sa mail=*@domain.tld " to get a full list of accounts. Up until now I've been connecting to and querying the mysql database directly. Since this would be used in production I think just querying the ldap would be quicker. It took me about 5 hrs to run through my 1900 accounts (as of this afternoon) and almost doubled the load on my server.
    zimbra@mailserv6:~> zmprov sa mail=*@mydomain.com |wc -l
    1907

    Keeping all of this in mind (and the fact that it did miss 2 or 3 accounts on my server.) If you still want this release posted on the wiki I'll get right on it.
    If you want a nice (hopefully more processor friendly) release give me the this weekend and some of next week and I'll see what I can do to improve on it.


    Thanks,
    Kyle
    Last edited by kechols; 09-01-2006 at 02:32 PM.

  6. #6
    Join Date
    Sep 2005
    Posts
    2,103
    Rep Power
    14

    Default zmmailbox command in 4.0

    totally off topic - but there's a partner command to zmprov in 4.0, zmmailbox. zmmailbox help commands for usage, but it's a CLI interface to manipulate mailboxes, should be handy to use.
    Bugzilla - Wiki - Downloads - Before posting... Search!

  7. #7
    Join Date
    Jun 2006
    Posts
    72
    Rep Power
    9

    Default

    I'm still on 3.1 unfortunately, though hopefully 4.0 will provide enough of an incentive to my bosses to let me upgrade it. We had a bad experience on the first upgrade attempt so I understand their lack of enthusiasm at the thought of another (unnecessary) attempt.

  8. #8
    Join Date
    Jun 2006
    Posts
    72
    Rep Power
    9

    Lightbulb

    Here is a script I created to delete aliased email accounts for you when deleting an aliased domain.

    It searches the mySQL database for email accounts, then queries the LDAP using zmprov to delete these aliased emails for you. It's slow (4 or 5 hrs for 1800+ users to be checked/deleted) but far faster than doing it by hand. and it only left two accounts for me to have to delete myself. If you find this happens to you, you can run " zmprov sa mail=*@domain.tld " to get a list of aliased accounts stilll on the server. I'll be working on a new script for this soon that implements this option instead of going through the database and pulling accounts. This should clear up some errors regarding non-existant accounts that may be thrown through the deletion process.

    I'm still working on getting this posted to the wiki but it doesn't like non image files being uploaded and seems to destroy formatting when i copy and paste.
    Attached Files Attached Files

Similar Threads

  1. "Away" message with Domain Aliases
    By itmike in forum Administrators
    Replies: 4
    Last Post: 06-06-2008, 07:26 AM
  2. Domain Alias / User Alias problem after upgrading.
    By Bingo in forum Administrators
    Replies: 1
    Last Post: 04-20-2007, 03:39 AM
  3. remove a zimbraGalLdapAttrMap from a domain
    By rafrio in forum Developers
    Replies: 0
    Last Post: 11-27-2006, 11:34 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
  •