09-22-2017 01:51 AM
Is it possible, using PowerShell, to list all AAD users' last login date (no matter how they logged in)? I have found a couple of scripts that check the last mailbox login, but that is not what we need, because we also want to list unlicensed users.
09-23-2017 07:51 AM
SolutionNo. Use the report in the O365 admin center -> Reports -> Usage -> Active users.
09-24-2017 10:10 PM
11-23-2017 09:57 AM
I think this is what you need.
The above functionality is available in AdminDroid Office 365 Reporter.
05-10-2018 06:38 AM
This might give you what you're after...
05-10-2018 08:02 AM
The provided script gives you the last login information of users who have Exchange Online license whereas the requirement is to display "last logon time" of unlicensed users as well.
05-10-2018 08:31 AM
Hi Robert,
I tested the script it also provides the logon times for "Unlicensed Users" as well and exports them to a .CSV.
05-10-2018 08:54 AM
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}
06-13-2018 01:26 PM
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?
06-13-2018 02:24 PM
Just a warning that using the Get-MailboxStatistics cmdlet to get this information is highly unreliable (see @Tony Redmond'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.
06-16-2018 08:19 PM
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.