Link to home
Start Free TrialLog in
Avatar of Yashy
YashyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Last Logged On Time from Exchange Shell stats different from Solarwinds Inactive users tool?

hi guys

So I got some help from EE experts to run a command in Exchange shell to export all mailbox statistics/data.

One of the important things is for me to work out the LastLoggedOnTime so that I can segregate the oldest mailboxes from the actively used ones.

I ran a tool called Inactive Users Tool by Solarwinds and exported it. When I compare the last logged on time of one user from the Exchange shell formula to the data exported from the Solarwinds one, they are different. I have many users who have not logged on for years, but somehow are showing as two days ago in the Shell statistics.

Perhaps the Solarwinds tool is using the Inactive users by looking at a different attribute?


Any ideas on why that would be?

Thanks for helping
Yashy
Avatar of timgreen7077
timgreen7077

see the below link to answer your question

https://social.technet.microsoft.com/Forums/windowsserver/en-US/ed694f51-12e0-446f-8312-74c630fd33b0/lastlogintime-of-mailbox-and-lastlogon-of-user?forum=winserverDS


Basically exchange shell is looking at the last time a user or agent accessed the mailbox while solar winds may be looking at the last time the user authenticated to AD.
Avatar of Yashy

ASKER

Ah, that makes sense Tim.

Is there anyway the script you just posted for me, can have the last time the user authenticated to AD at all?
ASKER CERTIFIED SOLUTION
Avatar of timgreen7077
timgreen7077

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also just a not, since Im not sure what version of powershell you are running, before you copy and paste the cmdlets in exchange shell run the following

import-module activedirectory

Newer versions of powershell will do this automatically since its detecting cmdlets that need the AD modules but older versions didn't so run that first just in case. After that then paste the cmdlets.
Avatar of Yashy

ASKER

Tim, thank you so much for doing this for me. When i run it though, I get errors in Exchange shell as it doesn't recognise the Get-AdUser:

The term 'get-aduser' 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:6 char:22
+ $ADUsers = get-aduser <<<<  -Identity $user.SamAccountName -properties LastLogonDate
    + CategoryInfo          : ObjectNotFound: (get-aduser:String) [], CommandNotFoundException

Is there a module that needs to be imported?
import-module activedirectory
Avatar of Yashy

ASKER

Just saw your previous message, hadn't refreshed it.

I tried now, worked a gem:). Thanks a million Tim!!
Avatar of Yashy

ASKER

P.s , where can I get some decent tutorials to learn scripting?
YouTube is what I use because there are so many free lessons its crazy
You can also check this earlier discussion for more information about last logon: https://www.experts-exchange.com/questions/29083863/AD-last-logon-vs-Mailbox-last-logon.html