Reporting on the Item Age (Count and Size) in a Mailbox using EWS and Powershell

Reporting on the Item Age (Count and Size) in a Mailbox using EWS and Powershell


This article has two really good scripts:
http://gsexdev.blogspot.com/2012/10/reporting-on-item-age-count-and-size-in.html

1. A summary script for collecting an ItemCount and Size by Year for message items in a mailbox.
2. A detailed script for collecting information on ItemCount and Size by Year and by Mailbox Folder for message items in a mailbox.


Here are some tips I had to do to get it to run:
1. I used mailboxname like this:  $MailboxName = "user@domain.com" in place of $args[0].
2. I had to change the path of the Microsoft.Exchange.WebServices.dll.
3. I changed the ExchangeVersion to match my current version.
4. I had to give the account I was authenticating full permissions to the mailbox I was running against:  add-mailboxpermission mbox -user username -accessrights fullaccess
5. When running the script and getting prompted for authentication, I had to authenticate with a upn (user@domain.com) and not using domain\user.
6. I had to adjust the out-file to a writable location.