MS Exchange 2007 Mailbox Statistics

Lets say you need to get information about all mailbox users in your Microsoft Exchange 2007 organisation. Quotas, mailbox size, item count, time when users logged in last time…

It is easy!

Don’t forget to use following in multi-domain environment : $AdminSessionADSettings.ViewEntireForest=$True

Query for Exchange Management Shell:

Get-Mailbox -ResultSize 'Unlimited' -IgnoreDefaultScope | Select DisplayName, Identity, Database, @{label="IssueWarning(MB)";e={(Get-Mailbox $_).IssueWarningQuota.Value.ToMb()}},@{label="ProhibitSend(MB)";e={(Get-Mailbox $_).ProhibitSendQuota.Value.ToMb()}},@{label="ProhibitSendReceive(MB)";e={(Get-Mailbox $_).ProhibitSendReceiveQuota.Value.ToMb()}},@{label="Uses Database Quota Defaults";e={(Get-Mailbox $_).UseDatabaseQuotaDefaults}}, @{label="TotalSize (MB)";e={(get-mailboxstatistics $_).TotalItemSize.Value.toMB()}}, @{label="Item Count";e={(get-mailboxstatistics $_).ItemCount}}, @{label="Last Logon";e={(get-mailboxstatistics $_).LastLogonTime}}| Export-CSV -Path ".\ExchangeStats.csv"