Exchange 2010 - Active Mailboxes

Hi All,

Is there a way to find how many active mailboxes are in a single database? Is there a powershell command I can run?


SJ HillAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Amit KumarCommented:
If you just need count of Mailbox users then use below command:

(Get-Mailbox -Database DEUP01).count

Open in new window

If need list then use below one

Get-Mailbox -Database DEUP01 | Select-Object * | export-csv activeusers.csv

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You can get a list of all users and their last login time.

Get-mailbox -resultsize unlimited| Get-MailboxStatistics | select displayname, lastlogontime
Will SzymkowskiSenior Solution ArchitectCommented:
All mailboxes that are enabled are considered active. Mail will always send to mailboxes that are enabled and assigned to an Active Directory User Object, disabled or not.

A good way to find out if the mailbox is actually being used by someone is check the lastLogonTime, which will give you a good indication if it is actually being accessed.

Use the below script to find all mailboxes that have been last accessed within 90 days...

The below script will find all mailboxes that have a LastLogonTime great than 90 days and export the results to a CSV file.
$date = get-date
$FindMB = get-mailbox -resultsize "unlimited"
ForEach ($mb in $FindMB)
           Get-MailboxStatistics | ? { $_.LastLogonTime -gt $date.AddDays(-90) } |
           Select DisplayName, LastLogonTime |
           Export-csv "c:\filename.csv" -nti -append       

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.