Trying to find out last mailbox logon time

Running a powershell command to display users mailbox size, item count etc....and along with that the last logon and logoff time. Problem is the last logon and logoff times all say 2:00 AM or somewhere around there. After giving it a brief moment of thought, it's getting that from System Maintenance (Mailbox Assistant) which runs every night starting at 2:00 AM. How do I get the clients (the actual user) last logon for mailbox. We have some mailboxes which I know are not being used but according to my spreadsheet, I can't tell because the Mailbox Assistant is time stamping everying when it runs maintenance. Do I actually have to disable maintenance for a few days just to get a valid timestamp?
shadowtuckAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
You can use get-mailboxstatistics -identity "username" | fl which will show you the LastLoggedOnUserAccount with LastLogOffTime and LogonTime.

You can then reference that date with

Get-aduser -identity "sAMAccountName" -Properties * | fl

Reference LastLogonDate

If the mailbox is not being used you can then reference the AD account as well.


Thanks

Will
0
shadowtuckAuthor Commented:
That works nicely. Is there any way to incorporate this so I get mailbox sizes at the same time? Otherwise, its two separate commands with different outputs and different spreadsheets.
0
Will SzymkowskiSenior Solution ArchitectCommented:
If you are refering to get-mailboxstatistics cmdlet this does show the mailbox size as well. When you are using Get-Aduser to reference the Logon with the get-mailboxstatistics these commands cannot be piped together to give you a single out-put.

What you can do is run both commands and simply use the -Append switch with will write to the same file and it will not overwrite previous entires.

You can script these commands together as well.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.