SQL Query to get Users last log-in date from MSCRM

SQL Query to get Users last log-in date from MSCRM

Execute this command against your MSCRM database (onpremise only)

select us.FullName, max(a.CreatedOn) as LastLoginDate from Audit a

inner join SystemUser us on a.ObjectId = us.SystemUserId

where

a.Operation = 4 and us.IsDisabled = 0

group by us.FullName

2018-07-04T09:29:35+00:00