I am running this against MSOL but don't think it will matter. I am looking to generate a report that shows mailboxes that have not been logged onto or ones that have not been logged onto in a while. So far, I am running get-mailbox -resultsize unlimited | Get-MailboxStatistics | Sort-object lastlogontime -Descending | fl displayname, LastLogonTime >C:\Users\username\Documents\LastLogonTime.CSV
My issues are:
1. Mailboxes that have not been logged into are not reported.
2. I have thousands of mailboxes and only want the output to show the ones with the most time since they were last logged onto. I am OK with just limiting the result size so long as the results are the ones with the most time since last logon.
Any ideas would be appreciated!
~Eric