Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Connect » Looking for script to output list groups and members
  •  
uptimjeff

Messages: 61
Karma: 1
Send a private message to this user
Short version:

Anyone know how I can script (bash?) 1 file per kerio group which lists the members of that group?

Long version:

I need to make the members of every group and mailing list available on our internal website.
A structure like this is what I planned:

domain1
groups
sales.html (contains all members of sales)
tech.html (contains all members of tech)
lists
list1.html (contains all members)
list2.html (contains all members)
domain2
groups
sales.html (contains all members of sales)
tech.html (contains all members of tech)
lists
list1.html (contains all members)
list2.html (contains all members)

I plan to update the html nightly via cron.

This will be easy enough to do for mailing lists because each mailing list has a text file with it's members within the kerio mailstore.

But I don't know how to extract this for Groups.
Seems groups are assigned to each user in users.cfg, there is no list of 'group' along with the members.

I'm a junior bash scripter... Anyone have suggestions or examples of how to parse users.cfg to output 1 file per group with the file containing a list of members?

FYI- running Kerio on OSX

Thanks
  •  
Petr Dobry (Kerio)

Messages: 782
Karma: 61
Send a private message to this user
This can be achieved by using Administration API for Kerio Connect - see our Developer Zone for details.

Petr Dobry
Product Development Manager | Kerio
  •  
TorW

Messages: 769
Karma: 9
Send a private message to this user
Although it's easier and much more robust in the long term to do it via the administration API, you can (if you really, really want to) parse users.cfg in a shell script with xmlstarlet. It's available from Softpedia as a universal binary download. Xmlstarlet is only meaningful in shell scripts.

For a syntax example, look at this link.
  •  
pcunix

Messages: 594
Karma: 33
Send a private message to this user
I'd recommend the API, but that might be a steep learning curve.

I'd definitely recommend perl - not too hard to learn if you have learned a little bit of grep. sed and awk.

I've attached a Linux perl script that could get you started with this. It's not great Perl, but if you understand scripting in general, you can probably understand it and modify for your needs.

I'm rushing out of here in a few minutes or I could take the time to do more of this for you, but it is a start.

Feel free to PM me with questions on it - I may not answer til Friday as I am out straight, but I will answer..

BTW, the reason I recommend Perl is that while the API is fantastic for Kerio admin and xmlstarlet ooks like a good xml tool, Perl is a general purpose tool that will serve you well on Mac, Linux and even Windows (though you need to install a Perl distro there).



  • Attachment: groups.pl
    (Size: 0.79KB, Downloaded 228 times)

[Updated on: Wed, 16 May 2012 12:59]


Tony Lawrence
Kerio Preferred Partner and Reseller
Certified for Connect, Control
http://aplawrence.com
Previous Topic: Upgrade KCB from 7.3->7.4, BESX recache?
Next Topic: strike out messages on delete
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Fri Oct 20 03:15:12 CEST 2017

Total time taken to generate the page: 0.00410 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.