Zimbra command

Restart:
zmcontrol stop
zmcontrol start

Show all account:
zmprov -l gaa

Show all admin account:
zmprov gaaa

Show all account with status, created date, last logon:
zmaccts

Show all user detail:
zmprov ga email@domain.com displayName description zimbraNotes zimbraCreateTimestamp zimbraLastLogonTimestamp

Show one user mailboxsize:
zmmailbox -z -m email@domain.com gms

Show all user mailboxsize:
#!/bin/bash

all_account=”/opt/zimbra/bin/zmprov”
for account in $($all_account -l gaa | sort );

do
mb_size=`zmmailbox -z -m ${account} gms`;
echo “Mailbox size of ${account} = ${mb_size}”;
done

Show all user detail:
#!/bin/bash

all_account=”/opt/zimbra/bin/zmprov”

true > /tmp/userReport.txt

for account in $($all_account -l gaa | sort );

do
user_detail=`zmprov ga ${account} zimbraAccountStatus zimbraCreateTimestamp zimbraLastLogonTimestamp zimbraMailDeliveryAddress`;
mb_size=`zmmailbox -z -m ${account} gms`;
displayName=`zmprov ga ${account} displayName | grep displayName`;
description=`zmprov ga ${account} description | grep description`;
zimbraNotes=`zmprov ga ${account} zimbraNotes | grep zimbraNotes`;
zimbraPrefMailForwardingAddress=`zmprov ga ${account} zimbraPrefMailForwardingAddress | grep zimbraPrefMailForwardingAddress`;

echo “${user_detail}”>>/tmp/userReport.txt;
echo “mailBoxSizeUsing: ${mb_size}”>>/tmp/userReport.txt;
echo “${displayName}”>>/tmp/userReport.txt;
echo “${description}”>>/tmp/userReport.txt;
echo “${zimbraNotes}”>>/tmp/userReport.txt;
echo “${zimbraPrefMailForwardingAddress}”>>/tmp/userReport.txt;
echo >>/tmp/userReport.txt;

done

Exchange 2010 recovery

new-mailboxdatabase -recovery -name RDB1 -server servername -edbfilepath “c:\rectemp\support\support.edb” -logfolderpath “c:\rectemp\support”

get-mailboxdatabase

cd c:\rectemp\support
eseutil.exe /mh support.edb
esetuil.exe /p support.edb

restore-mailbox -identity administrator -recoverydatabase RDB1 -recoverymailbox “Boss” -targetfolder “recoverfolder1”

restore-mailbox -identity administrator -recoverydatabase RDB1 -subjectkeywords “Meeting” -contentkeywords “business” -includefolders \inbox

dismount-database RDB1 -confirm:$false
remove-mailboxdatabase RDB1