Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-14-2009, 04:31 PM
Senior Member
 
Posts: 58
Default Export users

Hi all

I need to export all my users (email and description) to csv file, i am uisng

zmprov gaa but this command only return the email, I need 2 fields email and description.

Regards.
Reply With Quote
  #2 (permalink)  
Old 07-14-2009, 04:51 PM
Moderator
 
Posts: 1,554
Default

you could do a basic bash script to loop through all users

Code:
for i in `zmprov gaa` do
  (stuff here)
done
Reply With Quote
  #3 (permalink)  
Old 07-14-2009, 06:04 PM
Senior Member
 
Posts: 58
Default

Hi

But I not understand , what is the instruction inside the cycle ??

Regards.
Reply With Quote
  #4 (permalink)  
Old 07-14-2009, 06:13 PM
Moderator
 
Posts: 1,554
Default

you can do any number of commands inside the loop. if you do zmprov ga <account> you'll see all the attirbutes of the account. then you can do zmprov ga <account> <attribute1> <attribute2> and that will grab the attributes of the account you specify
Reply With Quote
  #5 (permalink)  
Old 07-17-2009, 09:42 AM
Advanced Member
 
Posts: 204
Default

I'm also having trouble with this. :-) What would be the code if I wanted to print account name and the attributes of First and Last Name?
Reply With Quote
  #6 (permalink)  
Old 07-17-2009, 11:24 AM
Outstanding Member
 
Posts: 594
Default

for i in `zmprov gaa` do
zmprov ga accountname gn
done

same way use sn for last name
Reply With Quote
  #7 (permalink)  
Old 07-17-2009, 11:34 AM
Advanced Member
 
Posts: 204
Default

Ok, I'm showing my inexperience... So this would be my script?:

#!/bin/bash
for i in `zmprov gaa` do
zmprov ga accountname gn
done

I guess I'm not sure how to run this... I keep getting "-bash: syntax error near unexpected token `zmprov'".
Reply With Quote
  #8 (permalink)  
Old 07-17-2009, 11:44 AM
Outstanding Member
 
Posts: 594
Default

Running as zimbra user ?
Reply With Quote
  #9 (permalink)  
Old 07-17-2009, 11:51 AM
Advanced Member
 
Posts: 204
Default

Yes, unless their's something I need to change in the script. I ran it as Zimbra user.
Reply With Quote
  #10 (permalink)  
Old 07-17-2009, 12:06 PM
Outstanding Member
 
Posts: 594
Default

You ran the script as it is. ok change it :-
#!/bin/bash
for i in `zmprov gaa` do
zmprov ga $i gn
done
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.