Date of last message received to a mailbox ?

by andiwoo at 2012-10-22 08:12:39

Hi there

I am new to PowerShell… so bear with me…

Is there some easy way - using PowerShell to get the following information ( if it is at all possible ! )

I need to find the date of the last email received to a particular mailbox - we have loads of mailboxes and need to see if they are still in active use… if not we can remove them…

Thanks in advance !

Andi
by DonJ at 2012-10-22 08:18:49
You might post this in our Exchange forum, if you’re talking about Exchange, but I don’t believe there’s a simple method, no. You’d need to crack open the mailbox and look at the date of the newest message in there, which will require a bit more than running a single command. It might be easier to look in AD and check the last logged-in date of your users, since that’s a lot more accessible, unless you have users who log in frequently but for some reason don’t use their mailboxes.
by andiwoo at 2012-10-22 08:24:02
Hi, Thanks for the reply…

Yes, I am talking about Exchange, and unfortunately these are shared mailboxes, so I believe the last logged on time might not hold any merit…

It seems so simple in theory… but turns out might be near impossible ?

Thanks again

Andi
by Pat Richard at 2012-10-23 13:51:49
So, what you’d have to do is connect to the mailbox using Exchange Web Services (EWS), then enumerate the items to find the most recent message. That could be extremely time and resource consuming. I have not used EWS in PowerShell, but Glenn Scales has, and has written quite a bit about it. Check out his examples at http://gsexdev.blogspot.com/