Shore Up
Small geometric forms collecting into one larger container, with a single form lifting away
CentOSLinuxZimbra Server

Zimbra Group Management – Batch File

Ketan Aagja9 min read
No ratings yet

Zimbra Group Management – Batch File, my another batch file to manage Groups or Distribution lists on Zimbra server from your Windows PC.

Check out my Zimbra User Management – Batch File : HERE

Find our more information about Zimbra here – Zimbra Collaboration Open Source Edition
It is very simple batch file, just to achieve three simple activities from Zimbra Group Management – Batch File using SSH from any windows PC:

  • Create Distribution List
  • Add Member to Group List
  • Remove member from Group

This is my guaranty, this batch file neither will affect any of your server operation nor it will modify any core configurations. It will only do the things that you are asking it to do!

Here are the basic requirements that you need when you use this batch file:

  • Install PUTTY on your windows PC where you will be using this batch file. (Get PUTTY – Free SSH and telnet Client for Windows – HERE)
  • Only use installer / setup of Putty, not the standalone Putty EXE
  • After installing Putty, just connect your Zimbra mail server first time using Putty from your Windows PC with ROOT User ID so that Putty can negotiate and accept ECDSA key fingerprint. Once done exit Putty.

My Zimbra Version - Release 8.7.3_GA_1750 (Centos 7 x64 - FOSS Edition)

Copy / Paste below batch file in notepad or any text editor.

Save as .bat file, modify below stated two lines and start using it confidently…!!!

Line No: 9 —  srv=Your Server’s IP

Line No: 11 — pws=Your Server’s ROOT User Password

Go for it…!!!

@echo off
SETLOCAL EnableDelayedExpansion
color 9f
mode con: cols=90 lines=35
title Zimbra Group Management Script - By: Ketan Aagja
set zmp=/opt/zimbra/bin/zmprov

::Change your zimbra server IP below
set srv=MY ZIMBRA SERVER IP
:: Change your zimbra server password below
set pws=ROOT PASSWORD

cls
echo 			    Designed by : KETAN AAGJA
echo.
echo.
echo.
echo.
echo 		   ****** PLEASE SELECT APPROPRIATE OPERATION ******
echo. 	

echo.
echo.
echo.
echo.
echo				 PRESS 1 - CREATE DISTRIBUTION LIST 
echo. 
echo.
echo. 	
echo.
echo.
echo				 PRESS 2 - ADD MEMBER TO GROUP LIST
echo.
echo.
echo.
echo.  	
echo.
echo				 PRESS 3 - REMOVE MEMBER FROM GROUP
echo.
echo.
echo.
echo.
set /p vid=SELECT AN OPTION :        
echo.
echo.
echo.

IF %vid%==1 GOTO grp
IF %vid%==2 GOTO mem
IF %vid%==3 GOTO rem1
IF NOT DEFINED %vid% GOTO away


:grp
cls
echo.
echo.
echo 			    *** PLEASE ENTER GROUP ID ***
echo. 	
echo.
echo.
echo. 
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
set /p vid1= GROUP ID :        
echo.
echo.
cls
echo.
echo.
echo.
echo.
IF EXIST %TMP%\grp.log del /F %TMP%\grp.log
echo !zmp! cdl !vid1! >> %TMP%\grp.log
echo !zmp! grr dl !vid1! usr dist-admin@bnscolorama.co.uk ownDistList >> %TMP%\grp.log
"C:\Program Files (x86)\PuTTY\putty.exe" -ssh root@%srv% -pw %pws% -m %TMP%\grp.log
CLS
color 2f
echo. 	
echo.
echo.
echo 	             *** !vid1! GROUP ID HAS BEEN CREATED ***
echo. 	
echo.
echo.
echo. 
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
echo 			   *** PRESS ANY KEY TO EXIT ***
pause >nul
exit

:mem
cls
echo.
echo.
echo 		      *** PLEASE ENTER GROUP ID ***
echo. 	
echo.
echo.
echo. 
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
set /p vid1= GROUP ID :     
echo.
echo.

cls
echo.
echo.
echo 		      *** PLEASE ENTER EMAIL ID ***
echo. 	
echo.
echo.
echo. 
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
set /p vid2= EMAIL ID :     
echo.
echo.
IF EXIST %TMP%\mem.log del /F %TMP%\mem.log
echo !zmp! adlm !vid1! !vid2! >> %TMP%\mem.log
"C:\Program Files (x86)\PuTTY\putty.exe" -ssh root@%srv% -pw %pws% -m %TMP%\mem.log
CLS
color 2f
echo.
echo.
echo.
echo 	     *** %VID2% HAS BEEN ASSIGNED TO %VID1% GROUP ***
echo. 	
echo.
echo.
echo. 
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
echo 			   *** PRESS ANY KEY TO EXIT ***
pause >nul
exit

:rem1
cls
echo.
echo.
echo 		      *** PLEASE ENTER GROUP ID ***
echo. 	
echo.
echo.
echo. 
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
set /p vid1= GROUP ID :     
echo.
echo.

cls
echo.
echo.
echo 		      *** PLEASE ENTER EMAIL ID ***
echo. 	
echo.
echo.
echo. 
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
set /p vid2= EMAIL ID :     
echo.
echo.
IF EXIST %TMP%\rem1.log del /F %TMP%\rem1.log
echo !zmp! rdlm !vid1! !vid2! >> %TMP%\rem1.log
"C:\Program Files (x86)\PuTTY\putty.exe" -ssh root@%srv% -pw %pws% -m %TMP%\rem1.log
CLS
color 2f
echo.
echo.
echo.
echo 	     *** %VID2% HAS BEEN REMOVED FROM %VID1% GROUP ***
echo. 	
echo.
echo.
echo. 
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
echo. 	
echo.
echo.
echo.
echo 			   *** PRESS ANY KEY TO EXIT ***
pause >nul
exit

:away
color 1f
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo             			*** GO AWAY BAD GUY ***
echo. 	
echo.
echo.
echo. 
echo.
echo.

ping -n 4 127.0.0.1 >nul

Do write me or share your views/suggestions on how simply this is saving your time and helping you manage Zimbra users.

Written by
Ketan Aagja

Runs enterprise networks and security for a living, and writes Shore Up to turn two decades of hands-on Linux, Windows and mail-server work into guides you can actually use.

More about the author →

Was this article helpful?

Tap a star — no sign-in needed.

Be the first to rate this article.

Whitelist or Blacklist per IP on Zimbra Server – Batch File

Are you getting many spam requests from IP addresses? Do you want to block or allow IPs instantly? It’s been one hectic task for Email Administrators when they need to manage IP based whitelist and blacklist. Well here is the hassle free solution…!!! Check out my other Zimbra Batch files: Zimbra User Management Zimbra Group / Distribution Lists Management You will have to apply and modify some of the changes to get this work for you on your Zimbra Open Source Collaboration Server. Here is the guide that you need to follow first before going further below. Click HERE I believe you have changed your…

7 min read

Zimbra User Management – Batch File

Everybody loves Zimbra. The best in class Zimbra Collaboration Open Source Email server with contacts, tasks and calendar management on your finger tips. I indeed love it and recommend it to small and medium businesses when they ask me how can we achieve best in-house Email server. Even many big data enterprises are also using this feature rich daemon. Find our more information about Zimbra here – Zimbra Collaboration Open Source Edition System / email administrators manages users from Zimbra Admin Panel where they can create / modify and delete users and do many things. However I find it quite lazy myself when administering users using Zimbra Admin Panel. Believe me, login on to Zimbra Admin panel, issuing…

12 min read

OpenLDAP Master Slave Replication In A Minute

Often I have seen that OpenLDAP Master Slave Replication seems heavy job for server administrators. Many articles are available to achieve this scenario but majority of the articles are so detailed that mostly administrators gets confused about their replication. Many time they applies replication configuration on server but loses data on either server or sometime whole database. Or gets locked out from database where they are not able to recover data. Many time, I also have made mistakes in learning OpenLDAP Master Slave Replication on my test servers, but just to understand and learn the whole process. Here is how you can achieve OpenLDAP Master Slave Replication in just a minute. Applied on CentOS Linux…

3 min read

Two way Dovecot Server Replication / Mirroring

Here is step-by-step guide to achieve two way Dovecot server replication / mirroring. I had been searching a lot to achieve two way dovecot server replication / mirroring and had been trying out many things. None methods were giving me sure shot and performance intensive results. Well you all do is, play with it more to understand it more and achieve more. This is what I did and achieved what I needed. Sharing with you all that what configuration I made with my both live production servers which are now replicating each and every emails with each other. I have not received any single email replication related issue since last 2 years. And still it is…

12 min read