Script for User Count Per Mailbox Database – Exchange 2007

Applies to: Exchange Server 2007

Here an Exchange Management Shell script that displays the user count per database.

Step 1: Create a new text file in C:Scripts named “Get-MailboxCountPerDatabase.ps1” and paste the code below into the text file.

write-host -fore yellow “This script will get each mailboxdatabase and the current user count ”
foreach($name in get-mailboxdatabase)
{
$count=(get-mailbox -database $name).count
write-host $count -nonewline
write-host ” mailboxes in $name”
}
write-host -fore yellow “The system has a total mailboxes of “$user=(get-mailbox –resultsize unlimited).count
write-host -fore red $user

Step 2: Once you have saved the text file, run the script file by entering it’s name into the Exchange Management Shell, (C:ScriptsGet-MailboxCountPerDatabase.ps1).

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>