Wednesday, September 11, 2013

Check last logon time in E2013

Ok, so gui pretty much out in Exchange 2013.
So if I want to check when users last logged on the mailbox for some reason we use powershell.
Make a script, typing is going to get old real fast.
To check latest logintime for users
-----------CheckLastlogon.ps1-------------
add-pssnapin microsoft.exchange.management.powershell.snapin
foreach ($user in get-content users.txt)
{
get-mailboxstatistics $user |select displayname,itemcount,lastlogontime,totalitemsize
}
---------------eof----------------------------------





If you want the results in a pretty displaybox, you can pipe |out-gridview like .\checklastlogon.ps1 | out-gridview.
To make the script pause after printing, add these lines:

write-host "press any key to end"
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

Good for those diehard powerhaters out there, or in here…
References:
http://exchangeserverpro.com/last-logon-time-exchange-2010-mailbox-users/



No comments: