Reporting on the Item Age (Count and Size) in a Mailbox using EWS and Powershell
This article has two really good scripts:
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 = “email@example.com” in place of $args.
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 (firstname.lastname@example.org) and not using domainuser.
6. I had to adjust the out-file to a writable location.