Here’s a handy one liner to get the last logon for every user to exchange online:

 

Get-Mailbox -resultsize unlimited | select Displayname,@{Name=’LastLogonTime’; Expression={[String]::join(“;”,((Get-MailboxStatistics -identity $_.userprincipalname).LastLogonTime))}},@{Name=’TotalMailboxSize’; Expression={[String]::join(“;”,((Get-MailboxStatistics -identity $_.userprincipalname).TotalItemSize))}},@{Name=’Database’; Expression={[String]::join(“;”,((Get-MailboxStatistics -identity $_.userprincipalname).Database))}},UserPrincipalName, @{Name=’MailboxType’; Expression={[String]::join(“;”,((Get-MailboxStatistics -identity $_.userprincipalname).MailboxTypeDetail))}} | sort DisplayName | export-csv c:\temp\LastLogon.csv

Note this can take a while to run depending on how many users you have.

Hope it helps!