I've found numerous codes online and have created the following to run a basic report on quotas and sizes of mailboxes on our SBS 2008 server (Exchange 2007):

get-mailbox -server HYDROMAIN -ResultSize unlimited | ft DisplayName,ProhibitSendReceiveQuota,ProhibitSendQuota,@{label="Mailbox Size(MB)";expression={(get-mailboxstatistics $_).TotalItemSize.Value.ToMB()}}

I would like to run the same report, weekly (on, say, Friday's), automatically, but have the report sorted from largest mailbox size to smallest. The report can be emailed in a .txt file or just in the body of the email. Or would it be better to sort by mailboxes that are the closest to their quotas? Or, is it possible to sort by mailbox size, and highlight (or differentiate) ones that are close to (or surpassed) their quotas?

Email sent to one specified address with custom subject and body header above the actual content (if not attached in .txt).

Would anyone be able to help me out? This is slightly above my understanding of the Exchange PowerShell. I'm very new to it and have only been using it for a few weeks.

I know it's probably pretty basic but I've been unable to get anything to work.

Thanks :)

  • Pipe your current command to Sort-Object mailboxsize ( which will be the name of the property you want to sort by) -desc. That will sort in descending order. – Davidw Feb 10 '14 at 2:01
  • I don't have an object called mailboxsize. And I'm unsure where to place that. I've changed the object name and placed it in the command but it's not working. Could you advise where to place it and what the object should be called (I'm using TotalItemSize from the mailbox stats) – Logan Feb 10 '14 at 2:20
  • Substitute TotalItemSize for mailbox size in my script. – Davidw Feb 10 '14 at 3:08
  • That's what I did and it didn't work so I'm assuming it was added in the wrong location of the script/command. Can you please show me exactly where it should be going in my script please. – Logan Feb 10 '14 at 3:10
  • Put the Sort-object before the format-list section. get-mailbox -server HYDROMAIN -ResultSize unlimited | Sort-Object TotalItemSize | ft DisplayName,ProhibitSendReceiveQuota,ProhibitSendQuota,@{label="Mailbox Size(MB)";expression={(get-mailboxstatistics $_).TotalItemSize.Value.ToMB()}} – Davidw Feb 10 '14 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.