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.
[PS] C:\>Get-MailboxStatistics "Alan Reid" DisplayName ItemCount StorageLimitStatus LastLogonTime ----------- --------- ------------------ ------------- Alan Reid 70163 BelowLimit 1/9/2011 10:59:51 PM
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.
[PS] C:\>Get-MailboxStatistics -Database MB-BR-01
DisplayName ItemCount StorageLimitStatus LastLogonTime
----------- --------- ------------------ -------------
Tina Miller 51896 BelowLimit
Andrew O'Grady 51774 BelowLimit
TestMB BR 8 BelowLimit 1/6/2011 12:16:05 AM
Jas Dowden 51517 BelowLimit
Laoise Curtis 51702 BelowLimit
Denise Dartnell 51804 BelowLimit
Pakwei Dean 51567 BelowLimit
Prathee Dar 51569 BelowLimit
Michael Phillips 51603 BelowLimit
Joy Singh 51753 BelowLimit
SystemMailbox{9ef3bf09-f222-4317-b216-3f592ab2f6a4} 45 BelowLimit
Wendy Fyson 1724 BelowLimit
Maggie Hengist 51099 BelowLimit
Joanna Hughes 51853 BelowLimit
Ravi Edmonds 51370 BelowLimit
Stuart Beauchamp 52192 BelowLimit
Nancy Scott 51282 BelowLimit
Harinder Rahman 51579 BelowLimit
Sharmila Hafri 51520 BelowLimit
Garth Gibbons 51691 BelowLimit
Jagir Ward 51491 BelowLimit
Rowena Khan 52083 BelowLimit
Aisha Bhari 4 BelowLimit
Lydia Haines 51690 BelowLimit
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.
[PS] C:\>Get-MailboxStatistics -Server ESP-BR-EX2010 | Sort LastLogonTime -Descending
DisplayName ItemCount StorageLimitStatus LastLogonTime
----------- --------- ------------------ -------------
Garth Gibbons 51691 BelowLimit 1/9/2011 11:38:00 PM
TestMB BR 8 BelowLimit 1/6/2011 12:16:05 AM
Nancy Scott 51282 BelowLimit
Harinder Rahman 51579 BelowLimit
Stuart Beauchamp 52193 BelowLimit
Joanna Hughes 51853 BelowLimit
Ravi Edmonds 51370 BelowLimit
Rowena Khan 52083 BelowLimit
Aisha Bhari 4 BelowLimit
Jagir Ward 51491 BelowLimit
Sharmila Hafri 51520 BelowLimit
Lydia Haines 51690 BelowLimit
Maggie Hengist 51099 BelowLimit
Laoise Curtis 51702 BelowLimit
Denise Dartnell 51804 BelowLimit
Jas Dowden 51517 BelowLimit
Tina Miller 51896 BelowLimit
Andrew O'Grady 51774 BelowLimit
Pakwei Dean 51567 BelowLimit
SystemMailbox{9ef3bf09... 45 BelowLimit
Wendy Fyson 20642 BelowLimit
Joy Singh 51753 BelowLimit
Prathee Dar 51569 BelowLimit
Michael Phillips 51603 BelowLimit




This episode coming at you from the depths of the Brisbane Sea…
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.
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.
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
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 .
Are you running it in the Exchange Management Shell?
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?
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.