Finding this information was a two-step process:
- Export all of the mailbox folder statistics to a CSV file
- Scrub the resulting data with Excel to get a list of the users and their departments with mail items over 180 days old
get-mailboxdatabase | get-mailbox -resultsize unlimited | get-mailboxfolderstatistics -folderscope all -includeoldestandnewestitems | export-csv mailbox_stats.csvThe cmdlets break down this way:
get-mailboxdatabasefetches each database (this infrastructure employs multiple databases)get-mailboxruns through each mailbox in the current databaseget-mailboxfolderstatisticsreturns specifics about the folders in the mailbox.-folderscope allreturns information about each folder under the top of information store and-includeoldestandnewestitemsincludes the dates of the oldest item in the folder and the newest item in the folderexport-csvobviously exports the results to a CSV file
- I used a filter on the
OldestItemReceiveDatefield with "before" criteria for 180 days prior to the cut-off date - Once I had the list of results narrowed down to those with mail items over 180 days, I used some VBA functions to extract the user name and the department (the users are placed into OUs by department and the result of the
get-mailboxfolderstatisticscmdlet is the full "path" to the users folder including domain and OUs, so it was pretty easy for me to get their department) - I then copied the results to a new list and used an advanced filter on this list to get unique records only, and I had the final list of users with items over 180 days.
1 comments:
My boss asked me to come up with a way to do this for items over 150 days. Can you do this for me?
Post a Comment