Hoping someone can help with this/it's an easy to explain issue, but basically I'm looking to find mailboxes in our Exchange 2010 environment that haven't been logged into for more than x days/a certain amount of time.
I've found several powershell scripts online which would/should seem to work by looking at the last logon time attribute for mailbox statistics, but when I try to export (or even just display the results in powershell), there seems to be a lot of mailboxes (but not all) that do not show any information for lastlogontime - it's just blank.
One of the scripts I used for example is below, but wondering if anyone has maybe a better way of finding this information or knows why these results aren't being generated as expected? Thank You in advance for any help you can offer!
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Where{$_.Lastlogontime -lt (Get-Date).AddDays(-90)} | Select DisplayName, LastLoggedOnUserAccount, LastLogonTime | Export-csv C:\Temp\InactiveUsers.csv