Wednesday, August 12, 2009

Find the mailbox count per db in a server

This script can be used to find the mailbox count per database by giving the mailbox server name. This can be modified easily as per your need.

#####################################################

# script for finding the no of mailbox's per mailboxdatabase
write-host $server = read-host "Type the server name:"
foreach ($db in get-mailboxdatabase -server $server)
{
if ($db.getType().fullname -like "*PublicFolderDatabase")
{
$dbType = "Public"
}
else
{
$dbType = "Private"
$dbUserCount = (get-mailbox -database $db -erroraction silentlycontinue).count
}
$retObj = new-object psobject
$retObj add-member noteproperty -name "Server" -value $db.Server
$retObj add-member noteproperty -name "Name" -value $db.Identity
$retObj add-member noteproperty -name "Users" -value $dbUserCount
$retObj
}

#################################################

Please let me know if you have any queastions.

Thanks

Logan
logu_microsoft@hotmail.com 971552596187

1 comment:

Anonymous said...

I've been surfing on-line greater than 3 hours as of late, but I by no means discovered any attention-grabbing article like yours. It's pretty worth enough for me.
Personally, if all web owners and bloggers
made excellent content as you probably did, the net shall be a lot more useful than ever before.


My blog post: InstaForex