Home » Exchange Server » How to Find Last Logon Time for Exchange 2010 Mailbox Users

How to Find Last Logon Time for Exchange 2010 Mailbox Users

In Exchange Server 2003 the last logon time for a mailbox was visible in the Exchange System Manager.  For Exchange Server 2007 and 2010 the last logon time was removed from the Exchange Management Console, and so we need to use a differnet method to find this information.

The last logon time of an Exchange 2010 mailbox user can be found by running the Get-MailboxStatistics cmdlet in the Exchange Management Shell.

You can also pipe other input into Get-MailboxStatistics, for example to see the statistics for all Exchange 2010 mailbox users on a particular mailbox database.

In the above example many of the users have no last logon date, because they have not logged on to their mailboxes since they were migrated to Exchange Server 2010. In this type of scenario you may wish to sort the results to see which Exchange 2010 mailbox users are yet to logon to their mailbox since a migration.

Paul is a Microsoft MVP for Office Servers and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul is a co-author of Office 365 for IT Pros and several other books, and is also a Pluralsight author.
Category: Exchange Server

24 comments

  1. Terrance Brennan says:

    unfortunately, this information shows whichever account last accessed the mailbox, not actually logged into it. Very often this is not the mailbox owner; but, rather an account that looked at the free/busy information information of the mailbox, access their calendar for a meeting, or service accounts such as BlackBerry.

  2. Dan says:

    Another trick I’ve used recently is after a night of mailbox migrations I would do

    ### Store all mailboxes that have moved into a variable named $a and that have a status of completed.

    $a = get-moverequests | ? {$_.Status -eq “Completed”}

    foreach ($i in $a) {get-mailboxstatistics “$i”}

    you can also put a the foreach statement into a variable and then do a count

    $z = foreach ($i in $a) {get-mailboxstatistics “$i”}
    $z.count

    I would run this the next day to see how many people I migrated have actually logged in to the new system. The more I’d see the better.

  3. Thanks this was very helpful. We migrated from SBS2003 so I was looking to provide the same functionality as the View Mailboxes plugin. Was helpful as the server rebooted and I wanted to make sure all users were online with Exchange.

    Cheers

  4. tom says:

    When ever i tired to run the Get-MailboxStatistics cmdlet it give me message
    The term ‘Get-MailboxStatistics’ is not recognized as the name of a cmdlet, function, script file, or operable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:22
    + Get-MailboxStatistics <<<< t007
    + CategoryInfo : ObjectNotFound: (Get-MailboxStatistics:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    ANy idea how to resolve this? otherwise i am not able to run the command .

  5. ATL says:

    I want to do the following:

    Get the Display Name and Last LogOn Time for any employee reporting to a specific manager in Active Directory, extract that information to an Excel Spreadsheet (sorted by logon time) and e-mail it.

    How can I do that?

  6. Chris says:

    Does this accurately reflect connections from OWA, iphones and the such.
    If so then I have 200 out of 1000 users who have not logged in for 2 years. (which does not suprise me)
    Thanks

    • Yes it should include those types of logins. You could test that yourself by picking an account that hasn’t logged on for years, resetting the password, and doing an OWA login, then checking if the last logon date has updated.

  7. Davis says:

    Is there a way to know for sure that the Last Logon Time is for the owner of the mailbox? In other words, if an assistant has permission to open their boss’s mailbox as an Additional Mailbox, does that affect the Logon Time, or is it only if that boss logs in?

    • The LastLoggedOnUserAccount property will tell you who that last logon was registered by.

      [PS] C:>Get-MailboxStatistics | select lastlog* | fl

      LastLoggedOnUserAccount :
      LastLogoffTime : 28/06/2013 12:51:06 PM
      LastLogonTime : 28/06/2013 12:45:56 PM

      • Daniel Chenault says:

        Unfortunately I’m not getting the desired results. I have a mailbox bsmith of an employee that has been terminated; AD account is disabled and manager is given full access.

        Bsmith left the company two weeks ago. Yet running
        Get-MailboxStatistics | select lastlog* | fl
        shows bsmith last accessed the mailbox this morning. This should show tjones, the manager.

        Ideas?

        • Jonathan says:

          Could be the refresh timing or a kerberos ticket not being expired. But also disconnect any mobile devices from the mailbox as it just shows the account connecting, now how it was connecting.

          You could also check the security log and see if it leads you anywhere.

  8. Anand says:

    I tried using the both command

    Get-MailboxStatistics –Database AP-EDB

    Get-MailboxStatistics –Server EXC01

    but both results didnt exceed after 297 records. the mailbox is more than that. Is this any limitation. How do I list out all mailbox in the EDB ?

    Please advice.

  9. Marco says:

    Hi,

    Is there a way to get the last logon times of users which i have in a Excel sheet?
    I have around a 160 users/mailboxes in a Excel sheet from which i would like to have the last logon time. Any ideas?

  10. John says:

    Is there anyway to pipe the last time a user access a mailbox that they have permission to, but is not there full time mailbox?

  11. Egoitz says:

    Hi,

    I´m using this script to obtain statistics for the mailboxes from one database:

    Get-MailboxStatistics -Database “db1″ | Select DisplayName, LastLoggedOnUserAccount, Database, ItemCount, TotalItemSize, LastLogonTime, LastLogoffTime | Sort-Object LastLogonTime -Descending | Export-CSV c:mailboxdb1.csv

    But I need to get also the field “company” (under organization) where we specify the office where the person works.

    I don´t know what´s the parameter or how to get it.

    Thanks in advance.

  12. Ivan says:

    Hi,

    Will this show the last logon specifically for the mailbox owner, or will it reflect any other logons from other users with full permissions?

Leave a Reply

Your email address will not be published. Required fields are marked *