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 admin user ID / password, searching users and managing specific tasks for users is so long. My IT team who are working under me believes, I always find shortcuts to do tasks. Well, I think its good to save time so that you can focus on something important… !!! This is why I created this Zimbra User Management – Batch file by using which you can directly manage users.
Following activities can be done from Zimbra User Management – Batch File using SSH from any windows PC:
- Reset User Password
- Unlock User Account
- Disable User Account
- Create new Email ID
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…!!!
You only have to change following in batch file nothing else:
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 1f mode con: cols=90 lines=35 title Zimbra Server 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 echo. echo. echo ****** PLEASE SELECT APPROPRIATE OPERATION ****** echo. echo. echo. echo. echo. echo PRESS 1 - TO RESET USER PASSWORD echo. echo. echo. echo. echo PRESS 2 - TO UNLOCK USER ACCOUNT echo. echo. echo. echo. echo PRESS 3 - TO DISABLE USER ACCOUNT echo. echo. echo. echo. echo PRESS 4 - TO CREATE NEW E-MAIL ID echo. echo. echo. echo. echo. echo. echo. echo. set /p vid=SELECT OPTION : cls IF %vid%==1 GOTO reset IF %vid%==2 GOTO unlock IF %vid%==3 GOTO disab IF %vid%==4 GOTO newacc IF NOT DEFINED %vid% GOTO away :reset 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 vid1= E-MAIL ID : echo. echo. cls echo. echo. echo *** PLEASE PROVIDE PASSWORD FOR %VID1% *** echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. set /p "vid3= Password : " echo. echo. IF EXIST %TMP%\reset.log del /F %TMP%\reset.log echo !zmp! sp !vid1! !vid3! >> %TMP%\reset.log "C:\Program Files (x86)\PuTTY\putty.exe" -ssh root@%srv% -pw %pws% -m %TMP%\reset.log CLS color 2f echo. echo. echo. echo *** !vid3! PASSWORD HAS BEEN SET *** echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo *** PRESS ANY KEY TO EXIT *** pause >nul exit :unlock cls echo. echo. echo *** PLEASE ENTER EMAIL ID TO UNLOCK *** echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. set /p vid1= E-MAIL ID : echo. echo. IF EXIST %TMP%\unlock.log del /F %TMP%\unlock.log echo %zmp% ma %vid1% zimbraAccountStatus active >> %TMP%\unlock.log "C:\Program Files (x86)\PuTTY\putty.exe" -ssh root@%srv% -pw %pws% -m %TMP%\unlock.log CLS color 2f echo. echo. echo. echo *** %VID1% HAS BEEN SET ACTIVE *** echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo *** PRESS ANY KEY TO EXIT *** pause >nul IF EXIST %TMP%\unlock.log del /F %TMP%\unlock.log exit :disab cls echo. echo. echo *** PLEASE ENTER EMAIL ID TO DISABLE *** echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. set /p vid1= E-MAIL ID : echo. echo. IF EXIST %TMP%\disable.log del /F %TMP%\disable.log echo %zmp% ma %vid1% zimbraAccountStatus closed >> %TMP%\disable.log "C:\Program Files (x86)\PuTTY\putty.exe" -ssh root@%srv% -pw %pws% -m %TMP%\disable.log CLS color 2f echo. echo. echo. echo *** %VID1% HAS BEEN DE-ACTIVATED *** echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo *** PRESS ANY KEY TO EXIT *** pause >nul IF EXIST %TMP%\disable.log del /F %TMP%\disable.log exit :newacc cls echo. echo. echo *** PLEASE ENTER EMAIL ID TO DISABLE *** echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. set /p vid1= E-MAIL ID : echo. echo. cls echo. echo. echo *** PLEASE ENTER FIRST NAME OF USER *** echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. set /p vid2= First Name : echo. echo. cls echo. echo. echo *** PLEASE ENTER LAST NAME OF USER *** echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. set /p vid3= Last Name : echo. echo. IF EXIST %TMP%\nacc.log del /F %TMP%\nacc.log echo %zmp% ca %vid1% %pass% givenName %vid2% sn %vid3% displayName '%vid2% %vid3%' >> %TMP%\nacc.log echo ping -n 3 127.0.0.1 >> %TMP%\nacc.log "C:\Program Files (x86)\PuTTY\putty.exe" -ssh root@%srv% -pw %pws% -m %TMP%\nacc.log CLS color 2f echo. echo. echo. echo *** FOLLOWING EMAIL ID HAS BEEN CREATED FOR %vid2% %vid3% *** echo. echo. echo. echo. echo. echo *** %vid1% *** echo. echo. echo. echo. echo. echo. echo. echo. echo. echo. echo *** PRESS ANY KEY TO EXIT *** pause >nul cls IF EXIST %TMP%\nacc.log del /F %TMP%\nacc.log exit :away color 9f 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.