Forum Discussion
List all users' last login date
Once you've logged in and authenticated against your Office 365 tenant, you can then use the below commands.
# Connects you to Windows Azure Active Directory
Connect-MsolService
# Gets Unlicenced users and lists the "DisplayName, LastLogonTime and LastLogoffTime"
Get-MsolUser -UnlicensedUsersOnly | Foreach {Get-MailboxStatistics $_.UserPrincipalName | Select DisplayName, LastLogonTime, LastLogoffTime}
- Jay CarperJun 13, 2018Brass Contributor
What about users who don't have mailboxes? I have a number of users for whom we have disabled the Exchange Online license. How can I get their logon statistics?
- Max FritzJun 13, 2018Iron Contributor
Just a warning that using the Get-MailboxStatistics cmdlet to get this information is highly unreliable (see TonyRedmond's great blog on that here: https://www.petri.com/get-mailboxstatistics-cmdlet-wrong). The Office 365 usage reports is really the better answer here.
- Jay CarperJun 17, 2018Brass Contributor
It's not only unreliable, it's impossible. Get-MailboxStatistics only returns statistics for mailboxes, but I specifically need logon statistics for people who do not have mailboxes.